Open GoogleCodeExporter opened 8 years ago
Original comment by Matthijs.Mullender
on 10 Dec 2008 at 9:03
I created a python 2.6 modification of your library to fix this a while ago (I
was
working on a site that heavily used redirects). Attached is a diff of my
changes that is
intended to solve this issue.
I created two methods to replace your single NTLM authentication method.
Control is
transparently handed back to the urllib2 opener between method calls, allowing
it to
handle error codes such as 302 redirects.
To keep the connection alive I've lovingly stolen the HTTP handler from the
urlgrabber library (http://linux.duke.edu/urlgrabber/).
Some caveats:
- I don't copy the undirected headers between requests like you do in your
original
library -- I couldn't see a reason to do so.
- I don't add a "Connection: close" header to the final request during NTLM
communication. It's unneeded as the urlgrabber HTTP handler allows us to keep
the
connection open between requests, avoiding unnecessary extra authentication.
- I haven't made a python 3.0 version.
- This hasn't been tested for six months and subsequent modification has
occurred,
so it may not work right away. I hope that the diff can at least suggest a
solution to
this issue.
Original comment by divinene...@gmail.com
on 3 Feb 2010 at 1:43
Attachments:
Original issue reported on code.google.com by
Matthijs.Mullender
on 10 Dec 2008 at 9:03