On Fri, Jun 21, 2013 at 9:45 AM, Ivan Zhakov <i...@visualsvn.com> wrote: >> On Fri, Jun 21, 2013 at 9:19 AM, Greg Stein <gst...@gmail.com> wrote: >>> Please revert this. You *cannot* rely on a 411 response. >>> >>> You are also not allowed to send a 1.1 request to a server for which >>> you don't know if they support 1.0 vs 1.1. > > On Fri, Jun 21, 2013 at 5:28 PM, Greg Stein <gst...@gmail.com> wrote: >> This has been quoted before, but I'll repeat it again. RFC 2145, Section 2: >> >> "One consequence of these rules is that an HTTP/1.1 message sent to an >> HTTP/1.0 recipient (or a recipient whose version is unknown) MUST be >> constructed so that it remains a valid HTTP/1.0 message when all >> headers not defined in the HTTP/1.0 specification [1] are removed." >> >> Removing the Transfer-Coding: chunked header completely alters the >> message. Thus, it cannot be sent to a 1.0 server. This is why you >> cannot rely on any particular behavior or response status. > > Hi Greg! Thanks for review. > > My patch doesn't rely on 411 response only: ra_serf will downgrade to > HTTP/1.0 if *any* HTTP/1.0 response received *or* HTTP/1.1 411 status > code.
We've seen 501 responses. We've seen other weird responses in the past. I think we even crashed some servers, iirc. But it just doesn't matter. You're not allowed to send a request like that. Period. > I've tested several browsers and they use HTTP/1.1 as first request. Doesn't matter what they do. Maybe they already know the target supports HTTP/1.1. Who knows? Who cares? RFC 2145 is very clear here. We've seen problems when we did not obey the rules. I spent a good bit of time fixing our code to obey them, in order to get this stuff working. >... > Problem with this approach that some servers may support HTTP/1.1 > partially. I.e. declare them as HTTP/1.1 but do not support chunked > Transfer-Encoding. Then fix that problem. Add a flag saying "busted_http11" and make it send requests with Content-Length after that. But the answer is *not* to start a connection using 1.0. -g