Martin Panter added the comment:

I have changed my opinion of the “peek hack” from 
<https://bugs.python.org/issue3566#msg231413>. It would be useful when doing 
non-idempotent requests like POST, to avoid sending a request when we know it 
is going to fail. I looked into how to implement it so that it works for SSL 
(which does not support MSG_PEEK), and the neatest solution I could think of 
would require changing the non-blocking behaviour of BufferedReader.peek(), as 
described in Issue 13322. So I will leave that for later.

Adding ConnectionClosed.v3.patch; main changes:

* Removed the connection_reused flag to HTTPResponse
* ConnectionClosed raised even for the first request of a connection
* Added HTTPConnection.closed flag, which the user may check before a request 
to see if a fresh connection will be made, or an existing connection will be 
reused
* ConnectionClosed now subclasses both BadStatusLine and ConnectionError
* Fixed http.client.__all__ and added a somewhat automated test for it

BTW these patches kind of depend on Issue 5811 to confirm that 
BufferedReader.peek() will definitely return at least one byte unless at EOF.

----------
Added file: http://bugs.python.org/file37941/ConnectionClosed.v3.patch

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

Reply via email to