Re: pconns and WHEN_SQUID_IS_NOT_HTTP1_1

2005-09-15 Thread Alex Rousskov
On Sat, 2005-09-10 at 23:54 +0200, Henrik Nordstrom wrote:

  The corresponding(?) bugzilla comment says
 
  ... uncovered another HTTP compliance bug in Squid where HTTP/1.1 
  messages was considered (partly) as implicitly keep-alive even if Squid is 
  still HTTP/1.0.
 
  What is wrong with considering HTTP/1.1 messages keep-alive by default? Are 
  we trying to catch cases where a (broken?) HTTP/1.1 agent expects Squid to 
  default to non-persistent connections because Squid is HTTP/1.0?
 
 HTTP/1.0 keep-alive can not be enabled unless the request explicitly 
 says this is understood by the requestor.

I am not sure I agree. Persistent connection is an optional optimization
without any guarantees (regardless of the protocol version). From
protocol point of view, it should be safe to send keep-alive in every
message with known length. What am I missing? Why do we need the
requester to understand the keep-alive token? 

Are we concerned about who is going to close the connection first? Some
other performance optimization like that? Or is it related to the known
message length issues?

 HTTP/1.1 alone does not imply 
 that the requestor implements HTTP/1.0 keep-alive

Agreed, but the above reasoning about pconns being an optimization
without guarantees should still apply. If the agent does not recognize
the keep-alive token, it will just treat the connection as
non-persistent, right? An agent may do that for many other reasons as
well, even if it does recognize the keep-alive token!

 The HTTP/1.0 keep-alive was never accepted into any standard

[ Side note: How about RFC 2068, Section 19.7.1? RFC 2616 cites it. ]

 Additionally a HTTP/1.1 response to a HTTP/1.0 request does not not 
 automatically imply keep-alive even if the response is a HTTP/1.1 
 response.

This is a difficult case since it is not clear whether the response
version or the lack of the keep-alive token take precedence. We can
assume Connection: close, but what would be the harm in assuming a
persistent connection?

[ An HTTP/1.1 server that does not send Connection: header to HTTP/1.0
client (that did send it!) should be fixed, IMO ]

  This is what the quote from the bug report is about.

I understand now, but I am not sure why assuming persistent connection
was a bug. Do you recall what was happening when connections were
assumed to be persistent?


The primary reason for these questions is the desire to make
httpMsgIsPersistent() an HttpMsg method without breaking too many
things, and with future HTTP/1.1 support in mind. At the first glance,
we do not need any information external to the message (and the old
interface kind of confirms that). Either message implies persistency or
it does not. But then I noticed old code that supplies http version that
does not come from the same message as the supplied http headers and
paused...

Now, it seems like we will need two things:

bool HttpMsg::wantsPconn(void) const;
and
bool connIsPeristent(const HttpRequest , const HttpReply );

with all the above questions applying to the second function, not the
first.

Thank you,

Alex.




Re: pconns and WHEN_SQUID_IS_NOT_HTTP1_1

2005-09-10 Thread Henrik Nordstrom



On Wed, 7 Sep 2005, Alex Rousskov wrote:


Should it be named WHEN_SQUID_IS_HTTP1_1 instead?


Probably. It is in the 2.5 version..


Can the intended semantics of httpMsgIsPersistent() be summarized as

The HTTP agent sending the supplied message
wants to keep the connection persistent (AND
we trust that agent can handle pconns).

That is,

Keep the connection with the agent persistent
if possible


Yes.

Or is it something else? I am afraid it is something more convoluted because 
I see client_side.cc forcing the HTTP version to 1.0 before calling that 
method(*).


If I am not mistaken this hardcoding to 1.0 was the earlier partial fix to 
the same problem. Can be removed now. Only need to make sure that removing 
this does not cause us to forward the requests as HTTP/1.1.. (I think this 
is already made sure elsewhere so it should be safe..).



The corresponding(?) bugzilla comment says

	... uncovered another HTTP compliance bug in Squid where HTTP/1.1 
messages was considered (partly) as implicitly keep-alive even if Squid is 
still HTTP/1.0.


What is wrong with considering HTTP/1.1 messages keep-alive by default? Are 
we trying to catch cases where a (broken?) HTTP/1.1 agent expects Squid to 
default to non-persistent connections because Squid is HTTP/1.0?


HTTP/1.0 keep-alive can not be enabled unless the request explicitly 
says this is understood by the requestor. HTTP/1.1 alone does not imply 
that the requestor implements HTTP/1.1 keep-alive as the signaling methods 
of HTTP/1.1 and HTTP/1.0 keep-alive is quite different. The HTTP/1.0 
keep-alive was never accepted into any standard, and can not be assumed to 
be understood unless signalled.


Additionally a HTTP/1.1 response to a HTTP/1.0 request does not not 
automatically imply keep-alive even if the response is a HTTP/1.1 
response. This is what the quote from the bug report is about.



Are we always sending explicit Connection: close/keep-alive headers?


Yes.

Would that take care of any ambiguities when talking to HTTP clients, 
regardless of the client HTTP version? Same for servers?


The problem the mentioned patch addresses is Squid-Server communication.

The other client side fragment (forcing http version to 1.0) was an 
earlier fix to the same problem on Client-Squid traffic.


(*) Although the version parameter of httpMsgIsPersistent() is currently 
unused.


As it should be while we are HTTP/1.0 only.

Regards
Henrik


Re: pconns and WHEN_SQUID_IS_NOT_HTTP1_1

2005-09-10 Thread Henrik Nordstrom


HTTP/1.0 keep-alive can not be enabled unless the request explicitly says 
this is understood by the requestor. HTTP/1.1 alone does not imply that the 
requestor implements HTTP/1.1 keep-alive as the signaling methods of HTTP/1.1


I obviously meant to say requestor implements HTTP/1.0 keep-alive ...

and HTTP/1.0 keep-alive is quite different. The HTTP/1.0 keep-alive was never 
accepted into any standard, and can not be assumed to be understood unless 
signalled.