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