[MERGE] Fix bug #229076 by fixing header names before sending the request.
mnordhoff at mattnordhoff.com
Sat May 17 19:46:38 BST 2008
Vincent Ladeuil wrote:
> Never leave a FIXME without giving detailed explanations... or
> you'll end up doing all the research work again :)
> See patch for explanations, roughly,
> python2.4/2.5/httplib/urllib/urllib2 internally capitalized
> (User-agent) header names (or lowercase (user-agent) them, it
> depends) when in fact at least one server/proxy on the earth
> expect them to be titled (User-Agent) and abort connections
> otherwise. Unfortunately, it is used by www.gnome.org* ;)
> It turns out python2.5 urllib2 in some recent version (didn't
> search which one exactly) fixed it by using title.
> Unfortunately it did it in a function I had to override to handle
> persistent connections (among other things).
> Anyway, thanks for reading until here, I'm just being a bit
> verbose to respect my introduction ;-)
> *: The bug is fixed, but I'm curious as a cat, so I'd like to
> know what is being used there, any pointers greatly appreciated.
Not that it matters, but...
> + headers = dict((name.title(), val) for name, val in headers.items())
Why not iteritems()?
More information about the bazaar