"GS" == Greg Stein firstname.lastname@example.org writes:
Greg Stein's new httplib.py (or Jeremy's?)
GS> Mine is a drop-in replacement for the current GS> httplib.py. httplib.HTTP is compatible with the current version GS> and does HTTP/1.0. httplib.HTTPConnection is similar to the GS> other (but (IMO) cleans up a few elements of the API); it does GS> HTTP/1.1, including persistent connections. This module follows GS> the design of the original httplib.py much more GS> closely. Jeremy's module uses a very different design approach GS> (no value judgement here; it's just different); also, it simply GS> copies over the old HTTP class, while mine derives the GS> compatible version from HTTPConnection. I'm not sure how much GS> testing Jeremy's has had, but I use my module for all GS> Python-based http work now. Some number of other people have GS> downloaded and used it, too.
GS> I would recommend my new module, given the two options.
I think I agree. I stopped working on my version quite some time ago, before I made enough progress to make it useful. Thus, it makes a lot of sense to use Greg's working code.
I'd be curious to see how to use HTTPConnection to do persistent connections and pipelined requests. It wasn't entirely clear from the code what I would need to do to keep the connection open. Do you just re-use the HTTPConnection object -- call putrequest again after getreply?
I like the revised API that Greg's code uses. The request method on HTTPConnection objects cleans the API up in exactly the right way. It has always seemed unnecessary to have many separate calls to add headers and then a call to endheaders after putrequest. Packaging them all together in one method will simplify client code a lot.
GS> I'll eventually have a davlib.py to add to the distribution, but GS> it needs more work. I'll contribute that later.