What would happen with your code if the version is HTTP/0.9? These are
clients written before the HTTP1.0 RFC! I think you need to parse the exact
version number and also consider the future versions as well:

pseudo code:

   if FVersion > 'HTTP/1.0' then
     FKeepAlive := true;

Regards,

SZ

On 5/15/07, Primož Gabrijelčič <[EMAIL PROTECTED]> wrote:
>
> Hello, everybody.
>
> Does anybody know why does HttpSrv (1.41, ICS v5) default to closing
> connection when client sends HTTP/1.1 request without a Connection:
> header?
> IOW, when THttpServer receives
>
> GET / HTTP/1.1
>
> it will close the connection after sending the response. If one adds
> 'Connection: keep-alive' to the request header, connection will stay open.
>
> This is a proper behaviour for HTTP/1.0 connections but I believe it is in
> violation of RFC 2616, which states:
>
> "8.1.2 Overall Operation
> A significant difference between HTTP/1.1 and earlier versions of HTTP is
> that persistent connections are the default behavior of any HTTP
> connection.
> That is, unless otherwise indicated, the client SHOULD assume that the
> server will maintain a persistent connection, even after error responses
> from the server."
>
> I suggest adding two lines to the very end of the
> THttpConnection.ParseRequest:
>
>    if FVersion = '' then
>        FVersion := 'HTTP/1.0';
>    if FVersion <> 'HTTP/1.0' then //Gp, 2007-05-15
>      FKeepAlive := true;          //Gp, 2007-05-15
> end;
>
> Primoz
>
>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to