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.

classification
Title: Added HTTP{,S}ProxyConnection
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: loewis Nosy List: gstein, gvanrossum, isalsberg, jhylton, loewis, misa, nnorwitz
Priority: low Keywords: patch

Created on 2002-02-08 21:39 by misa, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
httplib.patch misa, 2002-02-08 21:40 Patch for httplib.py
httplib.patch misa, 2002-06-24 03:02 Better documentation for the patched httplib.py
httplib.diff nnorwitz, 2003-01-11 01:15 isaac/nn patch 1
Messages (22)
msg38907 - (view) Author: Mihai Ibanescu (misa) Date: 2002-02-08 21:39
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.
msg38908 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-01 22:40
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?
msg38909 - (view) Author: Mihai Ibanescu (misa) Date: 2002-03-01 22:58
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.
msg38910 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-01 23:12
Logged In: YES 
user_id=6380

OK, thanks; I'll wait!
msg38911 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-06-11 18:42
Logged In: YES 
user_id=31392

misa-- any progress on this patch?
msg38912 - (view) Author: Mihai Ibanescu (misa) Date: 2002-06-11 18:47
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.
msg38913 - (view) Author: Mihai Ibanescu (misa) Date: 2002-06-24 03:03
Logged In: YES 
user_id=205865

The newer patch is generated against the latest CVS tree,
and it provides additional documentation.
msg38914 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-07-12 15:46
Logged In: YES 
user_id=6380

Assigning to Jeremy in the hope that he can provide a review.
msg38915 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-07-15 20:52
Logged In: YES 
user_id=31392

I'll take a look.
msg38916 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-07-15 21:21
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.
msg38917 - (view) Author: Mihai Ibanescu (misa) Date: 2002-07-15 21:37
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.
msg38918 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-07 21:17
Logged In: YES 
user_id=21627

misa, is a patch forthcoming?
msg38919 - (view) Author: Mihai Ibanescu (misa) Date: 2002-10-07 21:20
Logged In: YES 
user_id=205865

Boy, two months. Yes, I'll go back to working on the patch.
Sorry for the delay.
msg38920 - (view) Author: Mihai Ibanescu (misa) Date: 2002-11-05 20:56
Logged In: YES 
user_id=205865

I am having problems with proxying and keepalive
connections. Setting to a lower priority until I figure out
the documentation.
msg38921 - (view) Author: Isaac Salsberg (isalsberg) Date: 2002-12-15 00:52
Logged In: YES 
user_id=663978

To make this patch work with the "buggy"  IIS using python 
2.2 or 2.2.1 with https, You need to install also these 2 
patches:

551273 (fix httplib bug with 100 Continue) and
500311 (work around for buggy https servers)

Python 2.2.2 by the other hand, has already incorparated 
those two patches, so You only need to add the HTTP{S} 
(515003) proxy patch. But since httplib has changed,  Misa's 
diff file will fail.

I have created a diff file that works with python 2.2.2, which 
also includes a new example that works using a certificate  
file in PEM format. I wanted to attach the file, however
I could not find out how :-(
msg38922 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-12-15 02:09
Logged In: YES 
user_id=33168

Isaac, I don't believe SF allows you to attach a file to
someone else's patch.  Please submit a new patch.  In the
comments for the new patch refer to this patch and indicate
if it supercedes this patch (ie, should this patch be
closed).  Also, it would be nice if you can add a comment to
this patch mentioning the new patch number.  Thanks!
msg38923 - (view) Author: Isaac Salsberg (isalsberg) Date: 2002-12-20 01:54
Logged In: YES 
user_id=663978

Neal, taht's right, I can not attach a file. 
I don't think is a good idea to close this patch, because
Misa is still working on it to fix some  persistence issue.

The version I created is based on the current Misa's 
version, so it has the same persistence problem. It just
was adapted to be used with Python 2.2.2. So we need to
wait for Misa's final version. 

I sent the patch to Misa, in case he wants to atach it here 
meanwhile the last version arrives. Except for persistence, 
It is working for me in a production environment. 

Anyway, If You need the patch I can send it. Just give me 
an email address. 
msg38924 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-01-01 19:52
Logged In: YES 
user_id=33168

Isaac, can you send me the patch?  nnorwitz@users.sf.net
should work
msg38925 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-01-11 01:15
Logged In: YES 
user_id=33168

Uploading patch from Isaac Salsberg.  I removed some more
comments.  Jeremy (or Martin) can you review this.  If it's
read, I can check it in.

There still needs to be a doc and tests.  I'll check if
either of the old patches has any.
msg38926 - (view) Author: Greg Stein (gstein) * (Python committer) Date: 2003-11-01 00:25
Logged In: YES 
user_id=6501

Eek. Following this model, then when we want to add Basic
authentication support, then we'll have the following classes:

  HTTPBasicConnection
  HTTPSBasicConnection
  HTTPBasicProxyConnection
  HTTPSBasicProxyConnection

Oh, and what if we want Digest support? Another set of four?
But what if we want the connection to support *both* Basic
or Digest, depending upon how the server was configured?
Let's not forget the client certificates. Oh, and layering
DAV capability on this.

The point is: adding features by adding classes will produce
a combinatoric nightmare. While I certainly agree with the
idea of pushing proxy support "down" from urllib(2) into the
basic http classes, I'd rather see a design that doesn't
require a new class for every feature combination.

PEP 268 was the start of an attempt to rationalize the
various features around HTTP. Some of the basic feature sets
to support:

* SSL
* various forms of authentication (Basic, Digest, client
cert, ...)
* WebDAV
* Proxy
* Proxy auth

I'd much rather see proxy features folded right into the
connection classes, than to spawn new ones. Even better, I'd
suggest picking up PEP 268 and modifying it where "you"
(whoever might read this comment) disagree or have further
design ideas.

(IOW, count me a -1 to the approach suggested by this patch)
msg38927 - (view) Author: Mihai Ibanescu (misa) Date: 2003-11-03 14:58
Logged In: YES 
user_id=205865

Greg, I agree. I am not proud of the patch anymore - it is a
nightmare to maintain. I'll have a look at PEP 268 and
explore some other possiblities.

So, it's ok with me to close this as WONTFIX until we come
up with something better.
msg38928 - (view) Author: Isaac Salsberg (isalsberg) Date: 2003-11-04 20:32
Logged In: YES 
user_id=663978

Perhaps the patch is not using the best possible model, 
however is the only python code available that works FINE 
with proxies using HTTPS. 

It has been working for me for almost a year.

Thank you Misa, if you develop another version, please let me 
know.
History
Date User Action Args
2022-04-10 16:04:57adminsetgithub: 36055
2009-02-12 17:38:04ajaksu2linkissue1448934 dependencies
2002-02-08 21:39:17misacreate