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.

Author demian.brecht
Recipients Yuri.Bochkarev, agriffis, alanjds, amak, cananian, demian.brecht, gregory.p.smith, icordasc, jcea, jhylton, martin.panter, mhammond, orsenthil, r.david.murray, rbcollins
Date 2015-01-20.05:42:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Calling self.wfile.write(b"") should be equivalent to not calling write() at all, as far as I understand.

Right (or at least, as I understand it as well).

Really, this boils down to a philosophical debate: Should the standard library account for unexpected conditions where possible (within reason of course), or should it only account for conditions as described by specifications?

> 1. Client connects to server and sends short request; server accepts connection and possibly reads request
> [snip]

This flow makes sense and is well accounted for with your proposed change. However, misbehaving cases such as:

1. Client connects to server or proxy (possibly through a tunnel) and sends request; server/proxy accepts connection and possibly reads request
2. Server/proxy intends to send a response, but doesn't for any number of reasons (bug, still in development, etc)
3. The connection is not closed and subsequent requests may succeed

Granted, the result is unexpected and doesn't comply with HTTP RFCs. However, leading the user to believe that the connection has been closed when it actually hasn't is misleading. I've spent many an hour trying to hunt down root causes of issues like this and bashed my head against a keyboard in disbelief when I found out what the cause /really/ was. Because of those headaches, I still think that the introduction of an UnexpectedResponse, if well documented, covers both cases nicely, but won't heatedly argue it further :) If others (namely core devs) think that the introduction of ConnectionClosed exception is a better way to go, then I'll bow out. It would maybe be nice to have Senthil chime in on this.

> But to address your concern in any case, see the third paragram in <>.

I don't think that should be added at all as the issue that I'm describing can occur at any point, not only the first request.

On another note, were you interested in submitting a patch for this?
Date User Action Args
2015-01-20 05:42:24demian.brechtsetrecipients: + demian.brecht, jhylton, mhammond, gregory.p.smith, jcea, orsenthil, amak, rbcollins, cananian, r.david.murray, alanjds, agriffis, martin.panter, icordasc, Yuri.Bochkarev
2015-01-20 05:42:24demian.brechtsetmessageid: <>
2015-01-20 05:42:24demian.brechtlinkissue3566 messages
2015-01-20 05:42:24demian.brechtcreate