Fix a couple bugs caused by passing in unicode headers to urlopen.
Review Request #8619 — Created Jan. 15, 2017 and submitted — Latest diff uploaded
urlopen
is happy to accept a unicode object for headers, but it then tries to
use the ascii codec to encode them. If the text includes something that can't
be encoded, it would fail. This change fixes up a couple places where this was
causing problems for people.
Ran unit tests.