[Python-bugs-list] [ python-Bugs-487471 ] urllib2 proxyhandle won't work.

SourceForge.net noreply at sourceforge.net
Thu Oct 30 14:02:58 EST 2003


Bugs item #487471, was opened at 2001-11-30 12:54
Message generated for change (Comment added) made by jjlee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=487471&group_id=5470

Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Ha Shao (hashao)
Assigned to: Jeremy Hylton (jhylton)
Summary: urllib2 proxyhandle won't work.

Initial Comment:
For python 2.2b2:
Adding proxyhandler with build_opener, install_opener does not
work since order of the handlers does matter (my guess).

In the current code, new handlers are appended at the end
of the handlers list. At least under windows, the proxyhandle
will never got called if it is added with install_opener.
HTTPHandler always get called before proxyhandler if the
default list is altered.

The attached patch try to reserve the order of handlers
based on their baseclass when adding new handlers.

Handlers with the same baseclasses might be added
more than once. Not sure if it is a good thing or bad
thing. Current code will raise except when it trys to remove 
the default handlers twice.

Since order does matter, build_opener
should be repleased by a list like class such that
user can insert their handlers to specific place.

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

Comment By: John J Lee (jjlee)
Date: 2003-10-30 19:02

Message:
Logged In: YES 
user_id=261020

That last comment was from me (cookie problems, ironically).

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

Comment By: Nobody/Anonymous (nobody)
Date: 2003-10-30 18:57

Message:
Logged In: NO 

This should be closed. 
 
I don't recall which minor version of 2.2 this was introduced at, 
but there's no need to replace build_opener any more.  The 
most you have to do is to explicitly pass a handler or two to 
build_opener with appropriately set handler_order attributes.  
Or you can subclass the handlers. 

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

Comment By: Micah Stetson (micahs)
Date: 2003-05-08 00:29

Message:
Logged In: YES 
user_id=774014

I don't know about Ha Shao, but I have the problem with Python 2.2.2.  My work around was to
modify urllib2.build_opener to add the user's supplied handlers before the defaults.  Shao's idea
of a list-like class is probably better.


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

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-13 21:50

Message:
Logged In: YES 
user_id=33168

Ha Shao, I know there were many changes in Python 2.2.x in
this area.  Do you still have this problem?  Can this bug be
closed?

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

Comment By: Ha Shao (hashao)
Date: 2001-11-30 13:10

Message:
Logged In: YES 
user_id=8717

forgot some code and changed a stupid variable name.

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

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



More information about the Python-bugs-list mailing list