This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jan.kollhof
Recipients jan.kollhof
Date 2008-10-17.15:45:19
SpamBayes Score 0.00022328329
Marked as misclassified No
Message-id <1224258333.01.0.331002758914.issue4140@psf.upfronthosting.co.za>
In-reply-to
Content
When using a proxy to request URLs that require Digest Auth,
a header similar to the following is sent to the server:

Authorization: Digest ... uri="http://example.org/foobar/spam" ...

The server then responded with:

HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/6.0


When not using a proxy, the header sent will look like:

Authorization: Digest ... uri="/foobar/spam" ...

and the server responded as expected with a 200 OK.

I don't know what is at fault here, urllib2 or IIS,
but patching the urllib2 to not use the full URL, when creating 
the Digest Auth. header, works.

When a proxy is being used by urllib2, the Request's get_selector() will
always return the full URL instead of just the selector.
The code that creates the Digest auth. header also uses the
get_selector() to set the "uri="-part in the auth header.
Making sure that the "uri="-part is not a full URL all seems to work.
See the patched urllib2.py attached.

I have only tested the fix against the server I had problems with,
and it seems to be working.
History
Date User Action Args
2008-10-17 15:45:33jan.kollhofsetrecipients: + jan.kollhof
2008-10-17 15:45:33jan.kollhofsetmessageid: <1224258333.01.0.331002758914.issue4140@psf.upfronthosting.co.za>
2008-10-17 15:45:31jan.kollhoflinkissue4140 messages
2008-10-17 15:45:30jan.kollhofcreate