Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add SKIP_HEADER for skipping automatically added headers#2018

Merged
sethmlarson merged 5 commits into
urllib3:masterfrom
sethmlarson:skip-user-agent
Oct 27, 2020
Merged

Add SKIP_HEADER for skipping automatically added headers#2018
sethmlarson merged 5 commits into
urllib3:masterfrom
sethmlarson:skip-user-agent

Conversation

@sethmlarson
Copy link
Copy Markdown
Member

@sethmlarson sethmlarson commented Oct 5, 2020

Closes #2014, Closes #2021

Changed the sentinel from SUPPRESS_USER_AGENT to SKIP_HEADER for skipping 3 of the automatically added headers Accept-Encoding, Host, and User-Agent.

cc @nateprewitt could you test this to ensure it works as you're expecting?

Comment thread src/urllib3/_collections.py
@sethmlarson sethmlarson requested review from hodbn and pquentin October 5, 2020 17:08
Comment thread src/urllib3/connection.py Outdated
@sethmlarson
Copy link
Copy Markdown
Member Author

Thanks @hodbn for the test case, I added you as a coauthor to the patch you sent me :)

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 16, 2020

Codecov Report

Merging #2018 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2018   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines         2290      2298    +8     
=========================================
+ Hits          2290      2298    +8     
Impacted Files Coverage Δ
src/urllib3/util/__init__.py 100.00% <ø> (ø)
src/urllib3/_collections.py 100.00% <100.00%> (ø)
src/urllib3/connection.py 100.00% <100.00%> (ø)
src/urllib3/util/request.py 100.00% <100.00%> (ø)
src/urllib3/util/ssl_.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1f05ae...57f76e1. Read the comment docs.

Comment thread src/urllib3/connection.py Outdated
Comment thread src/urllib3/connection.py Outdated
Comment thread src/urllib3/connection.py
@sethmlarson sethmlarson changed the title Fix SKIP_USER_AGENT for non-ASCII headers Add SKIP_HEADER for skipping automatically added headers Oct 18, 2020
@sethmlarson
Copy link
Copy Markdown
Member Author

@hodbn Thanks for the review, good catch on the copy issue. HTTPConnectionPool was saving us with a .copy() call due to proxy headers but we can't rely on that at the HTTPConnection level. Added stricter test cases for this.

@sethmlarson sethmlarson requested a review from hodbn October 18, 2020 22:37
This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't modify type of headers object within HTTPConnection.request() Discussion around 1.26.0 header encoding

3 participants