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