Skip to content

Commit

Permalink
Use popall instead of in/del pair (#2002)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov authored Jun 22, 2017
1 parent 02e3724 commit a05fa9e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions aiohttp/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,8 @@ def _create_proxy_connection(self, req):
except OSError as exc:
raise ClientProxyConnectionError(*exc.args) from exc

if hdrs.AUTHORIZATION in proxy_req.headers:
auth = proxy_req.headers[hdrs.AUTHORIZATION]
del proxy_req.headers[hdrs.AUTHORIZATION]
auth = proxy_req.headers.pop(hdrs.AUTHORIZATION, None)
if auth is not None:
if not req.ssl:
req.headers[hdrs.PROXY_AUTHORIZATION] = auth
else:
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/formdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _gen_form_data(self):
)
# FIXME cgi.FieldStorage doesn't likes body parts with
# Content-Length which were sent via chunked transfer encoding
part.headers.pop(hdrs.CONTENT_LENGTH, None)
part.headers.popall(hdrs.CONTENT_LENGTH, None)

self._writer.append_payload(part)

Expand Down
3 changes: 1 addition & 2 deletions aiohttp/web_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ def _do_start_compression(self, coding):
self._payload_writer.enable_compression(coding.value)
# Compressed payload may have different content length,
# remove the header
if hdrs.CONTENT_LENGTH in self._headers:
del self._headers[hdrs.CONTENT_LENGTH]
self._headers.popall(hdrs.CONTENT_LENGTH, None)

def _start_compression(self, request):
if self._compression_force:
Expand Down

0 comments on commit a05fa9e

Please sign in to comment.