Skip to content

Handler breaks custom user-agent #4

@andreymal

Description

@andreymal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions