[Patches] [ python-Patches-515003 ] Added HTTP{,S}ProxyConnection

noreply@sourceforge.net noreply@sourceforge.net
Mon, 15 Jul 2002 14:37:37 -0700


Patches item #515003, was opened at 2002-02-08 16:39
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=515003&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Mihai Ibanescu (misa)
Assigned to: Jeremy Hylton (jhylton)
Summary: Added HTTP{,S}ProxyConnection

Initial Comment:
This patch adds HTTP*Connection classes for proxy
connections. Authenticated proxies are also supported.

One can argue urllib2 already implements this. It does
not do HTTPS tunneling through proxies, and this is
intended to be lower-level than urllib2.

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

>Comment By: Mihai Ibanescu (misa)
Date: 2002-07-15 17:37

Message:
Logged In: YES 
user_id=205865

- I agree about the comments. I'll make them reasonable.
- one underscore is fine
- I intended to have a patch that works with python 1.5, but
then again the module itself doesn't run with 1.5 anyway, so
good point.
- When you make a connection to a server through a proxy,
you have to connect to the proxy, but everything else should
be the same, i.e. the Host: field has to refer to the server
and so on. I wanted to reuse the code from _set_hostport,
which saves the host and port in self.host, self.port. Had
to do it twice, once for the proxy hostname, once for the
server's. _set_hostport takes care of the default port and
of the "hostname:port" syntax, which is convenient.

I'll put together a patched patch and upload it.


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

Comment By: Jeremy Hylton (jhylton)
Date: 2002-07-15 17:21

Message:
Logged In: YES 
user_id=31392

The proposed classes seem useful enough, but I would like to
make several suggestions for the implementation.

- There are too many comments.  Comments should only be
added when 
   the intent of the code needs to be explained.  We
definitely don't need
   one comment for each line of code.  The comment in the
HTTPS proxy
   putrequest() is an example of a helpful comment.

- Just use a single underscore for private variables.

- Please use string methods instead of the string module.

- I don't understand the logic of switching the host/port
back and forth.


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

Comment By: Jeremy Hylton (jhylton)
Date: 2002-07-15 16:52

Message:
Logged In: YES 
user_id=31392

I'll take a look.


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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-07-12 11:46

Message:
Logged In: YES 
user_id=6380

Assigning to Jeremy in the hope that he can provide a review.

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

Comment By: Mihai Ibanescu (misa)
Date: 2002-06-23 23:03

Message:
Logged In: YES 
user_id=205865

The newer patch is generated against the latest CVS tree,
and it provides additional documentation.

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

Comment By: Mihai Ibanescu (misa)
Date: 2002-06-11 14:47

Message:
Logged In: YES 
user_id=205865

Sorry, been caught with a zillion of other things to do.
I'll try to reorganize it somehow and ask for opinions.

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

Comment By: Jeremy Hylton (jhylton)
Date: 2002-06-11 14:42

Message:
Logged In: YES 
user_id=31392

misa-- any progress on this patch?


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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-01 18:12

Message:
Logged In: YES 
user_id=6380

OK, thanks; I'll wait!

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

Comment By: Mihai Ibanescu (misa)
Date: 2002-03-01 17:58

Message:
Logged In: YES 
user_id=205865

I will add documentation and show the intended usage.
urllib* doesn't deal with proxying over SSL (using CONNECT
instead of GET/POST). urllib* also use the compatibility
classes, HTTP/HTTPS, instead of HTTPConnection (this is not
an argument by itself).
Thanks for the suggestion.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-01 17:40

Message:
Logged In: YES 
user_id=6380

This patch fails to seduce me. There's no explanation why
this would be useful, or how it should be used, and no
documentation, and a hint that urllib2 already does this.

Maybe you can get someone who's known on python-dev to
champion it, if you think it's useful?

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

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