Martin Panter added the comment:

See Issue 3566 about tweaking the “http.client” module’s BadStatusLine handling 
to be more helpful when implementing persistent connections. I am dumping some 
thoughts here about persistent connections with the “http.client” module, 
gained by working on that bug.

* Lib/xmlrpc/client.py appears to have persistent connection support, so may be 
useful for this bug.

* RFC 7230 §6.5 <https://tools.ietf.org/html/rfc7230#section-6.5> mentions 
monitoring for connection closure. This could be be partly implemented inside 
HTTPConnection by polling for closure before sending a request, but to fully 
implement might require the co-operation of the user calling into the module to 
check for closure at other times using select() or similar.

* Current “http.client” assumes that each socket.makefile() object will not 
buffer any data from a subsequent response. Unsure if this is a problem in the 
real world, but I ran into it implementing test cases. E.g. if the server 
anticipates the first few bytes of the subsequent response:

c.send(b"HTTP/1.1 200 Okay\r\nContent-Length: 0\r\n\r\n" b"HTTP/")

then the client misses the “HTTP/” and raises BadStatusLine("1.1 200 Okay\r\n").

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9740>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to