kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
MIT License
2.72k stars 388 forks source link

Fix patching of is_connection_dropped from urllib3 (issue #468) #605

Open peterisr opened 3 years ago

peterisr commented 3 years ago

Fix patching of is_connection_dropped from urllib3

With old patching method, urllib3 never detected TCP connections that were closed by the server side. For example, persistent HTTP connection that were closed by the server (e.g., due to timeout) were not recognized as closed. Any following requests that attempted to reuse the same, closed connection caused the following failure:

urllib3.exceptions.ProtocolError: ('Connection aborted.',
   RemoteDisconnected('Remote end closed connection without response'
))

Fixes: https://github.com/kevin1024/vcrpy/issues/468

corps commented 2 years ago

:+1: I ran into this issue as well using vcr with 1.1 http connections, this PR helped me work a fix into my code. Would love to see this hit master so I can remove my patch.

larstiq commented 1 year ago

We also carry this as local patch, would be nice to see the issue fixed.