[Python-Dev] more on httplib

Greg Stein gstein@lyra.org
Sun, 11 Jun 2000 04:01:50 -0700


All of the work below has been completed except for the errno==32 stuff.

Module:  http://www.lyra.org/greg/python/httplib.py
History: http://www.lyra.org/cgi-bin/viewcvs.cgi/gjspy/httplib.py/

There are three items left, that I know of:
  1) need doc for new stuff
  2) need new test cases
  3) I want to remove a "feature" of the old HTTP class. This would be a
     change in behavior, but (IMO) minor. Specifically, if the Status-Line
     is malformed, the old httplib.py would return (-1, <malformed line>,
     None) and store <file ob hooked to socket> into self.file. Nominally,
     that file object allows a client to read more data from the socket
     after the parse problem on the malformed Status-Line. I think it is
     useless, unused by any clients out there, and it causes me pain to
     provide it :-)  I'd like to just store None into self.file

Thoughts? Comments? I'd like to get this thing into Python RSN.

Cheers,
-g

On Sat, Jun 03, 2000 at 04:13:55PM -0700, Greg Stein wrote:
> I would like to propose a few changes to the (new) httplib:
> 
> *) drop HTTPS() -- this class isn't in 1.5.2, so there isn't a reason to
>    provide backwards-compat for it
> 
> *) revamp the pipeline support:
> 
>    - record the "last response object" ... when a new getreply() is done,
>      then we store the "last" into response.prior
>    - reading of the "HTTP/1.1 <code> <msg>" line is deferred, and
>      performed by the response object
>    - the read of that line is lazy
>    - if the response line is read *before* the "prior" response (if any) 
>      is "closed", then an exception is raised: ResponseNotReady
> 
> *) address some of Moshe's concerns:
> 
>    - use class-based exceptions
>    - clarify that HTTPConnection is designed for *blocking* sockets
>    - conn.close() followed by conn.send() will reopen the socket. This
>      could lead to programming errors. I'll add a class-based default flag
>      to disable this behavior.
>    - in request(), we check for errno==32 ... what to do on Windows?
> 
> 
> I will implement these changes in small chunks so that each can be
> reviewed in my CVS repository. The history is available at:
> 
>     http://www.lyra.org/cgi-bin/viewcvs.cgi/gjspy/httplib.py/

-- 
Greg Stein, http://www.lyra.org/