Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Mar 2018 15:43:36 -0700] rev 37014
url: add HTTP handler that uses a proxied socket
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.
# no-check-commit because we must name http_open that way
Differential Revision: https://phab.mercurial-scm.org/D2722
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 13 Mar 2018 17:42:00 -0700] rev 37013
util: observable proxy objects for sockets
We previously introduced proxy objects and observers for file objects
to help implement low-level tests for the SSH wire protocol.
In this commit, we do the same for sockets in order to help test the
HTTP server.
We only proxy/observe some socket methods. I didn't feel like
implementing all the methods because there are so many of them and
implementing them will provide no short term value. We can always
implement them later.
# no-check-commit because we implement foo_bar methods on stdlib types
Differential Revision: https://phab.mercurial-scm.org/D2721
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 13 Mar 2018 09:45:56 -0700] rev 37012
hgweb: allow defining Server response header for HTTP server
By default, the string contains the Python version. Server
operators may want to change this.
Because we like deterministic tests, we change the test harness
to always set this value to a known string. Various globs over
the server header have now been removed.
# no-check-commit because we add version_string()
Differential Revision: https://phab.mercurial-scm.org/D2840