Skip to content

Commit e03384f

Browse files
authored
Merge pull request #163 from Jonney/patch-2
Compatible with Python 3.11
2 parents 4863477 + c970092 commit e03384f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pproxy/proto.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,12 +616,21 @@ def abort(self):
616616
self.close()
617617
ssl.connection_made(Transport())
618618
async def channel():
619+
read_size=65536
620+
buffer=None
621+
if hasattr(ssl,'get_buffer'):
622+
buffer=ssl.get_buffer(read_size)
619623
try:
620624
while not reader.at_eof() and not ssl._app_transport._closed:
621-
data = await reader.read(65536)
625+
data = await reader.read(read_size)
622626
if not data:
623627
break
624-
ssl.data_received(data)
628+
if buffer!=None:
629+
data_len=len(data)
630+
buffer[:data_len]=data
631+
ssl.buffer_updated(data_len)
632+
else:
633+
ssl.data_received(data)
625634
except Exception:
626635
pass
627636
finally:

0 commit comments

Comments
 (0)