In <h7pdan$5i...@reader1.panix.com> John Gordon <gor...@panix.com> writes:

> According to the documentation, these two sections of code should be
> equivalent:

>   conn = httplib.HTTPSConnection(host)
>   conn.putrequest("POST", url)
>   conn.putheader("Proxy-Authorization", myProxy)
>   conn.putheader("Content-Length", "%d" % len(body))
>   conn.endheaders()
>   conn.send(body)

> vs

>   headers = { "Proxy-Authorization": myProxy }
>   conn = httplib.HTTPSConnection(host)
>   conn.request("POST", url, body, headers)

> And yet they are not.  The first section works, but I get an
> "HTTP/1.1 401 Unauthorized" error from the second.

To follow up my own post, this was happening because of a trailing
newline in myProxy, put there by base64.encodestring().

The newline made the server stop processing any subsequent headers.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gor...@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to