( )⚙ D2722 url: add HTTP handler that uses a proxied socket

This is an archive of the discontinued Mercurial Phabricator instance.

url: add HTTP handler that uses a proxied socket
ClosedPublic

Authored by indygreg on Mar 8 2018, 12:31 AM.

Details

Summary

Now that we have a socket proxy that can log I/O, we need to teach
mechanisms that open URLs how to use it.

We invent a custom HTTP handler class that knows how to proxy
sockets as soon as they are opened. We teach the high-level
opener() to accept logging arguments so a logging HTTP handler
can be constructed.

We don't yet support intercepting HTTPS sockets because I
don't want to go down that rabbit hole.

For the record, the urllib API is crazy and it took way too long
to figure out at what levels I needed to plug in to modify
the socket.

  1. no-check-commit because we must name http_open that way

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

indygreg created this revision.Mar 8 2018, 12:31 AM
This comment was removed by admin.
This comment was removed by admin.
admin added a subscriber: admin.Mar 8 2018, 3:45 PM
indygreg edited the summary of this revision. (Show Details)Mar 12 2018, 8:07 PM
durin42 accepted this revision.Mar 19 2018, 9:36 PM
This revision is now accepted and ready to land.Mar 19 2018, 9:36 PM
This revision was automatically updated to reflect the committed changes.