mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 11:19:23 +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,9 +225,12 @@ 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:
|
||||||
raise NetLibIncomplete(
|
if not result:
|
||||||
"Expected %s bytes, got %s" % (length, len(result))
|
raise NetLibDisconnect()
|
||||||
)
|
else:
|
||||||
|
raise NetLibIncomplete(
|
||||||
|
"Expected %s bytes, got %s" % (length, len(result))
|
||||||
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user