Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
post_data_len = 0
elif method == "POST":
# get length of post data
post_data_len = 0
for header in self.headers:
if header.lower() == "content-length":
post_data_len = int(self.headers[header])
break
# exceed limit?
if post_data_len > self.PostDataLimit:
self.send_error(413, "Local proxy error, Sorry, Google's limit, file size up to 1MB.")
self.connection.close()
return
else:
# unsupported method
self.send_error(501, "Local proxy error, Method not allowed.")
self.connection.close()
return
# get post data
post_data = ""
if post_data_len > 0:
post_data = self.rfile.read(post_data_len)
if len(post_data) != post_data_len:
# bad request
self.send_error(400, "Local proxy error, Post data length error.")
self.connection.close()
return
# create new path
#path = urlparse.urlunparse((scm, netloc, path, params, query, ""))
path=self.path
if(path.find("/")==0):
path=path[1:]
dhs = []
for header in self.headers:
hl = header.lower()
if hl == "if-range":
dhs.append(header)
elif hl == "range":
dhs.append(header)
for dh in dhs:
del self.headers[dh]
#del self.headers["Host"]
# create request for GAppProxy
params = urllib.urlencode({"method": method,
"encoded_path": base64.b64encode(path),
"headers": base64.b64encode(str(self.headers)),
"postdata": base64.b64encode(post_data),
"version": "1.0.5"})
# accept-encoding: identity, *;q=0
# connection: close
#print params
request = urllib2.Request("http://hakanzn.appspot.com/fetch.py")
request.add_header("Accept-Encoding", "identity, *;q=0")
request.add_header("Connection", "close")
#print request
#request.add_header("Host",bedava_site)
# create new opener
try:
resp = urllib2.urlopen(request, params)
except urllib2.HTTPError, e:
if e.code == 404:
self.send_error(404, "Local proxy error, Fetchserver not found at the URL you specified, please check it.")
elif e.code == 502:
self.send_error(502, "Local proxy error, Transmission error, or the fetchserver is too busy.")
else:
self.send_error(e.code)
self.connection.close()
return
except urllib2.URLError, e:
if local_proxy == "":
shallWeNeedGoogleProxy()
self.connection.close()
return
# parse resp
# for status line
line = resp.readline()
print line
words = line.split()
status = int(words[1])
reason = " ".join(words[2:])
print status,reason
# for large response
if status == 592 and method == "GET":
self.processLargeResponse(path)
self.connection.close()
return
# normal response
try:
self.send_response(status, reason)
except socket.error, (err, _):
# Connection/Webpage closed before proxy return
if err == errno.EPIPE or err == 10053: # *nix, Windows
return
else:
raise
# for headers
text_content = True
while True:
line = resp.readline().strip()
# end header?
if line == "":
break
# header
(name, _, value) = line.partition(":")
name = name.strip()
value = value.strip()
# ignore Accept-Ranges
if name.lower() == "accept-ranges":
continue
self.send_header(name, value)
# check Content-Type
if name.lower() == "content-type":
if value.lower().find("text") == -1:
# not text
text_content = False
self.send_header("Accept-Ranges", "none")
self.end_headers()
# for page
if text_content:
data = resp.read()
if len(data) > 0:
self.wfile.write(zlib.decompress(data))
else:
self.wfile.write(resp.read())
self.connection.close()
def del_garbage(self):
del self.https
del self.path
del self.headers
del self.uahdr
del self.host
del self.port
del self.advhost
del self.newline
del self.requestline
del self.injectline
del self.phost
del self.pport
del self.puser
del self.ppass
class ThreadingHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
def handle_error(self, request, client_address):
pass
class HTTPProxyService():
def __init__(self):
self.httpd = ThreadingHTTPServer((sets.LHOST, sets.LPORT), ProxyHandler)
self.httpd.allow_reuse_address = True
def serve_forever(self):
self.httpd.serve_forever()
class Server:
def __init__(self, get):
self.get = get
def __init__(self):
self.long = 79
self.sets = Sets()
self.name = Info('name').get_info()
self.ver = Info('ver').get_info()
self.form = Info('about').get_info()
self.auth = Info('by').get_info()
self.mail = Info('mail').get_info()
#self.conf = conf
self.noyes = [ru('No'), ru('Yes')]
self.version = [ru('Default'), ru('HTTP/1.0'), ru('HTTP/1.1')]
self.method = [ru('HEAD'),
ru('GET'),
ru('POST'),
ru('DELETE'),
ru('CONNECT'),
ru('OPTIONS'),
ru('TRACE'),
ru('PUT')]
self.line = [ru('\r\n'), ru('\n')]
self.split = [ru('Default'),
ru('%s' % (self.line[self.sets.ILINE] * self.sets.ILINE)),
ru('%s' % (self.line[self.sets.ILINE] * self.sets.ILINE)),
ru('%s' % (self.line[self.sets.ILINE] * self.sets.ILINE)),
ru('%s' % (self.line[self.sets.ILINE] * self.sets.ILINE)),
ru('%s' % (self.line[self.sets.ILINE] * self.sets.ILINE))]
def subs(self, data = '', cut = False):
if data:
data = data
else:
data = 'None'
if cut:
if len(data) > 5:
data = '%s...' % data[:5]
return data
def about(self, title = ''):
self.info = []
self.info.append('=[ %s ]%sn' % (title, '=' * (self.long - len(title) - 5)))
self.info.append('Name : %sn' % self.name)
self.info.append('Version : %sn' % self.ver)
self.info.append('Author : %sn' % self.auth)
self.info.append('Mail : %sn' % self.mail)
self.info.append('nn')
return ru(''.join(self.info))
def warning(self, title = ''):
self.info = []
self.info.append('=[ %s ]%sn' % (title, '=' * (self.long - len(title) - 5)))
self.info.append('Sale : This program not for sale !!!n')
self.info.append("Mirror : Don't mirror this file/program outside gembox.us !!!n")
self.info.append('nn')
return ru(''.join(self.info))
def donate(self, title = ''):
self.info = []
self.info.append('=[ %s ]%sn' % (title, '=' * (self.long - len(title) - 5)))
self.info.append('Paypal : [email protected]')
self.info.append('Payza : [email protected]')
self.info.append('nn')
return ru(''.join(self.info))
def log(self, title = ''):
self.info = []
self.info.append('=[ %s ]%sn' % (title, '=' * (self.long - len(title) - 5)))
self.info.append('nn')
return ru(''.join(self.info))
def show(self):
sys.stderr.write(self.config('Configuration'))
sys.stderr.write(self.log('Ready'))
def run(self):
LogWindow(True)
HTTPProxyService().serve_forever()
def pinger(self):
while 1:
time.sleep(random.randint(30, 300))
Pinger().check()
if __name__ == '__main__':
services = [threading.Thread(target=Server().run, args=()), threading.Thread(target=Server().pinger, args=())]
for serving in services:
serving.start()
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team