( )⚙ D3246 keepalive: rewrite readinto() to not use read()

This is an archive of the discontinued Mercurial Phabricator instance.

keepalive: rewrite readinto() to not use read()
ClosedPublic

Authored by durin42 on Apr 11 2018, 3:50 PM.

Details

Summary

It turns out http.client on Python 3 sometimes uses readinto() in the
implementation of read(). Unfortunately, Python 2 doesn't have a
readinto() in httplib's client, so we have to support both codepaths.

Subclassing is bad, folks.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Apr 11 2018, 3:50 PM
durin42 edited the summary of this revision. (Show Details)Apr 11 2018, 4:42 PM
durin42 updated this revision to Diff 8015.
indygreg accepted this revision.Apr 12 2018, 11:15 AM
indygreg added a subscriber: indygreg.

This is horrible. But this is the world we live in. Everything about the HTTP code terrifies me. That includes both our code and CPython's.

This revision is now accepted and ready to land.Apr 12 2018, 11:15 AM
This revision was automatically updated to reflect the committed changes.