Subject: [hybi] Suggesting adding Content-length: 0 to responses

From: Willy Tarreau <[email-masked]>
Date: Sat, 22 Jan 2011 11:39:54 +0100

Hi,

I noticed that Apache as an intermediary considers 101 as 1xx and waits for
a final response. However, if the response contains a "Content-length: 0",
then it immediately sends the response and closes.

Note that it does not forward the Upgrade header anyway, so the WS server
should normally not return a 101.

My point is that it does not cost much to add "Content-length: 0" in
responses (and some broken intermediaries will probably do it anyway), and
it makes some known incompatible intermediaries fail early and cleanly.

Any opinion ?

Regards,
Willy

---

From: Bjoern Hoehrmann <[email-masked]>
Date: Sat, 22 Jan 2011 12:12:16 +0100

>then it immediately sends the response and closes.

That is likely because such a message is malformed: 1xx responses do not
have a message body by definition and must not include one, but Content-
Length would indicate the presence of a message body. Websocket clients
should rather abort the connection attempt if they see a Content-Length
or Transfer-Encoding header on the 101 response, as I suggested earlier.
-- 
Björn Höhrmann · mailto:[email-masked] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

---

From: Willy Tarreau <[email-masked]>
Date: Sat, 22 Jan 2011 12:51:55 +0100

> or Transfer-Encoding header on the 101 response, as I suggested earlier.

I agree. The problem here is that the client gets nothing after the handshake !
My concern precisely is to inform the client it should abort.

Willy