mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
When we see an incomplete read with 0 bytes, it's a disconnect
Partially fixes mitmproxy/mitmproxy:#593
This commit is contained in:
parent
73376e605a
commit
f7bd690e3a
@ -225,6 +225,9 @@ class Reader(_FileLike):
|
|||||||
"""
|
"""
|
||||||
result = self.read(length)
|
result = self.read(length)
|
||||||
if length != -1 and len(result) != length:
|
if length != -1 and len(result) != length:
|
||||||
|
if not result:
|
||||||
|
raise NetLibDisconnect()
|
||||||
|
else:
|
||||||
raise NetLibIncomplete(
|
raise NetLibIncomplete(
|
||||||
"Expected %s bytes, got %s" % (length, len(result))
|
"Expected %s bytes, got %s" % (length, len(result))
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user