Different results for request() vs putrequest()

John Gordon gordon at panix.com
Thu Sep 3 17:43:51 EDT 2009


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.

Anyone know why?

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




More information about the Python-list mailing list