-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
gh-69152: Add _proxy_response_headers attribute to HTTPConnection #26152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0200725
7d8cefc
367893d
48d9119
ec7f577
6d59c02
232240e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -858,6 +858,7 @@ def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, | |
| self._tunnel_host = None | ||
| self._tunnel_port = None | ||
| self._tunnel_headers = {} | ||
| self._proxy_response_headers = None | ||
|
|
||
| (self.host, self.port) = self._get_hostport(host, port) | ||
|
|
||
|
|
@@ -943,21 +944,11 @@ def _tunnel(self): | |
| response = self.response_class(self.sock, method=self._method) | ||
| (version, code, message) = response._read_status() | ||
|
|
||
| self._proxy_response_headers = parse_headers(response.fp) | ||
|
|
||
| if code != http.HTTPStatus.OK: | ||
| self.close() | ||
| raise OSError(f"Tunnel connection failed: {code} {message.strip()}") | ||
| while True: | ||
| line = response.fp.readline(_MAXLINE + 1) | ||
| if len(line) > _MAXLINE: | ||
| raise LineTooLong("header line") | ||
| if not line: | ||
|
||
| # for sites which EOF without sending a trailer | ||
| break | ||
| if line in (b'\r\n', b'\n', b''): | ||
| break | ||
|
|
||
| if self.debuglevel > 0: | ||
| print('header:', line.decode()) | ||
|
|
||
| def connect(self): | ||
| """Connect to the host and port specified in __init__.""" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to how it is done in lines 337-341