[Patches] [ python-Patches-1667860 ] urllib2 raises an UnboundLocalError if "auth-int" is the qop

SourceForge.net noreply at sourceforge.net
Sun Feb 25 18:37:24 CET 2007


Patches item #1667860, was opened at 2007-02-24 15:19
Message generated for change (Comment added) made by jjlee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1667860&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Atul Varma (varmaa)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 raises an UnboundLocalError if "auth-int" is the qop

Initial Comment:
If a proxy server is connected to that specifies the "auth-int" quality of protection (qop) code--or any qop code aside from "auth", actually--urllib2 raises an UnboundLocalError exception.  While this patch doesn't implement auth-int, it does modify the behavior of urllib2 such that it raises a URLError with the reason "qop '%s' is not supported', where %s is the name of the qop code.

Two unit tests that test urllib2's functionality with an in-process proxy can be found at:

  http://varmaa.googlepages.com/Urllib2ProxyTests.py

I will try to attach this file to this patch ticket if I can.  I am also interested in integrating this unit testing suite with the Python standard lib unit tests, and am willing to work with you if this is desirable.  One of the unit tests in this suite succeeds with the standard version of urllib2.py, but the other fails unless this patch is applied.

This patch (and the unit test suite) applies to Python 2.4 and 2.5.


----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2007-02-25 17:37

Message:
Logged In: YES 
user_id=261020
Originator: NO

This looks useful.

It would be nice to test failure cases too (e.g. wrong password,
.add_password() not called, ...).

I think if this goes into a new file (which might be reasonable), it
should be named something like test_urllib2_localnet.py , to allow for
adding more loopback tests, which will not always involve proxy handling. 
I suppose it should NOT depend on the network resource flag
(Lib/test/regrtest.py -u network) since it's only localhost.

Style (see PEP 8):

Don't put whitespace inside brackets -- e.g. bad: fn( arg ) good: fn(arg)

Use this_kind_of_name or thiskind if short, not thisKind.

Imports and classes etc. don't need comments to label them as such. 
Probably is useful to label the BaseHTTPServer code though (maybe '# Local
proxy test infrastructure').

See e.g. end of Lib/test/test_urllib2net.py for appropriate stdlib test
boilerplate.

Your patch has inconsistent line endings, BTW.


----------------------------------------------------------------------

Comment By: Atul Varma (varmaa)
Date: 2007-02-24 15:20

Message:
Logged In: YES 
user_id=863202
Originator: YES

File Added: Urllib2ProxyTests.py

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1667860&group_id=5470


More information about the Patches mailing list