Retain the httplib import to continue using its constants, but actually make
the http(s) connections using httplib2. The latter has built-in support for
proxy settings, which then actually allows people behind proxies to interact
with Gerrit.
Compared to httplib, the biggest changes are:
- There's only one Http class instead of HTTPConnection and HTTPSConnection.
- Http.request() returns a tuple (response, contents).
- Http.request() expects a full URI instead of just a path, as Http's
constructor does not take a host parameter.
- The response object inherits from dict.
- All headers in a response are lower-cased.
All in all, it is possible to see that httplib2 support was retro-fitted
into the code, but that should not worsen its readability.
Changes since https://chromium-review.googlesource.com/c/458221/:
- Catch httplib2.ServerNotFoundError exceptions in GceAuthenticator, as httplib2
catches socket.gaierror (which was previously being used to detect when
metadata.google.internal was not accessible) and throws a ServerNotFoundError
exception instead.
Patch written in collaboration with Alexis Menard <alexis.menard@intel.com>.
BUG=672729
R=alexis.menard@intel.com,agable@chromium.org,tandrii@chromium.org
Change-Id: Iaefa9caf3d8c0bc6ff67f562cd0b6bd9fade2f24
Reviewed-on: https://chromium-review.googlesource.com/458480
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com>
changes/80/458480/4
Raphael Kubo da Costa8 years agocommitted byCommit Bot