failed hopes
This commit is contained in:
parent
94738dd5db
commit
c0d4330383
12
core/irc.py
12
core/irc.py
|
@ -66,7 +66,9 @@ class crlf_tcp(object):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
data = self.recv_from_socket(4096)
|
data = self.recv_from_socket(4096)
|
||||||
self.ibuffer += data
|
print(type(self.ibuffer))
|
||||||
|
print(type(data))
|
||||||
|
self.ibuffer += (data.decode('utf-8'))
|
||||||
if data:
|
if data:
|
||||||
last_timestamp = time.time()
|
last_timestamp = time.time()
|
||||||
else:
|
else:
|
||||||
|
@ -88,9 +90,11 @@ class crlf_tcp(object):
|
||||||
while True:
|
while True:
|
||||||
line = self.oqueue.get().splitlines()[0][:500]
|
line = self.oqueue.get().splitlines()[0][:500]
|
||||||
print(">>> %r" % line)
|
print(">>> %r" % line)
|
||||||
self.obuffer += line.encode('utf-8', 'replace') + '\r\n'
|
|
||||||
while self.obuffer:
|
self.obuffer += (line + '\r\n')
|
||||||
sent = self.socket.send(self.obuffer)
|
|
||||||
|
while len(self.obuffer) > 0:
|
||||||
|
sent = self.socket.send(self.obuffer.encode('utf-8', 'replace'))
|
||||||
self.obuffer = self.obuffer[sent:]
|
self.obuffer = self.obuffer[sent:]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import fuckit
|
import fuckit
|
||||||
import _thread
|
import _thread
|
||||||
import traceback
|
import traceback
|
||||||
|
import queue
|
||||||
|
|
||||||
|
|
||||||
_thread.stack_size(1024 * 512) # reduce vm size
|
_thread.stack_size(1024 * 512) # reduce vm size
|
||||||
|
@ -99,7 +100,7 @@ class Handler(object):
|
||||||
|
|
||||||
def __init__(self, func):
|
def __init__(self, func):
|
||||||
self.func = func
|
self.func = func
|
||||||
self.input_queue = Queue.Queue()
|
self.input_queue = queue.Queue()
|
||||||
_thread.start_new_thread(self.start, ())
|
_thread.start_new_thread(self.start, ())
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
|
@ -73,7 +73,7 @@ def normalize(url):
|
||||||
# Always use uppercase A-through-F characters when percent-encoding.
|
# Always use uppercase A-through-F characters when percent-encoding.
|
||||||
# All portions of the URI must be utf-8 encoded NFC from Unicode strings
|
# All portions of the URI must be utf-8 encoded NFC from Unicode strings
|
||||||
def clean(string):
|
def clean(string):
|
||||||
string = str(unquote(string), 'utf-8', 'replace')
|
string = b""+(unquote(string)).decode('utf-8', 'replace')
|
||||||
return unicodedata.normalize('NFC', string).encode('utf-8')
|
return unicodedata.normalize('NFC', string).encode('utf-8')
|
||||||
path = quote(clean(path), "~:/?#[]@!$&'()*+,;=")
|
path = quote(clean(path), "~:/?#[]@!$&'()*+,;=")
|
||||||
fragment = quote(clean(fragment), "~")
|
fragment = quote(clean(fragment), "~")
|
||||||
|
|
Loading…
Reference in New Issue