[gerrit_util] Add proxy support for other HTTP methods

Bug: b/351039944
Change-Id: If65096cd1023d695270ee4285a9ed27fcd944738
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5805746
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
changes/46/5805746/3
Allen Li 8 months ago committed by LUCI CQ
parent 8f617b4617
commit 617f167a13

@ -58,7 +58,8 @@ import subprocess2
#
# Changes:
# * all string literals changed to bytes literals.
# * all __symbols changed to _socksocket__symbols.
# * added more http methods to recognize.
# * all __symbols changed to _socksocket__symbols (Python __ munging).
# * Type annotations added to function signature.
def __fixed_rewrite_proxy(self: httplib2.socks.socksocket, header: bytes):
""" rewrite HTTP request headers to support non-tunneling proxies
@ -70,7 +71,8 @@ def __fixed_rewrite_proxy(self: httplib2.socks.socksocket, header: bytes):
for hdr in hdrs:
if hdr.lower().startswith(b"host:"):
host = hdr
elif hdr.lower().startswith(b"get") or hdr.lower().startswith(b"post"):
elif hdr.lower().split(b" ")[0] in (b"get", b"head", b"post", b"put",
b"patch"):
endpt = hdr
if host and endpt:
hdrs.remove(host)

Loading…
Cancel
Save