Skip to content
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

Handler breaks custom user-agent #4

Open
andreymal opened this issue Jul 10, 2016 · 1 comment
Open

Handler breaks custom user-agent #4

andreymal opened this issue Jul 10, 2016 · 1 comment
Labels
Milestone

Comments

@andreymal
Copy link

Without this:

>>> from urllib.request import *
>>> r = Request('http://localhost:8989/')
>>> r.add_header('User-Agent', 'foo')
>>> urlopen(r)
GET / HTTP/1.1
Accept-Encoding: identity
Connection: close
Host: localhost:8989
User-Agent: foo

With this:

>>> from urllib.request import *
>>> from keepalive import HTTPHandler
>>> opener = build_opener(HTTPHandler())
>>> install_opener(opener)
>>> r = Request('http://localhost:8989/')
>>> r.add_header('User-Agent', 'foo')
>>> urlopen(r)
GET / HTTP/1.1
Host: localhost:8989
Accept-Encoding: identity
User-agent: Python-urllib/3.5  # <--- WAT
User-agent: foo
@wikier wikier added this to the 0.6 milestone Jul 12, 2016
@wikier wikier added the bug label Jul 12, 2016
@wikier
Copy link
Owner

wikier commented Jul 12, 2016

There is no custom User-Agent handling in keepalive, @andreymal; so I don't know where/when urllib could be adding that header. I'll take a look anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants