You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Kennard <pe...@livingwork.com> on 2007/03/10 23:17:00 UTC

Keep Alive handling

for HTTP1.1 (in tomcat 6)

Does tomcat handle keep alive (ie: keeping a connection open for 
subsequent requests)

If so under what circumstances is the connection closed (or kept open)?

Sending chunked content, with a terminal "\r\n0\r\n" will cause the 
connection to be disconnected.

As does only a termainal "\r\n0"

In both cases following this I am then attempting to write the next 
HTTP header set for the next request from the client.

ie:

POST /url/ HTTP1.1
...

PK




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Keep Alive handling

Posted by Peter Kennard <pe...@livingwork.com>.
>What if you use a non-chunked request? You asked already and the
>response was that TC basically doesn't handle chunked requests.

TC handles chunked requests in all ways except that it doesn't have a 
methodology in the servlet API (EOFException etc) for notifying you 
if you try to read beyond EOD.  Chunking is a requirement of HTTP1.1.

TC appears at least from what I can tell. to always close the socket 
on completion of a request - unless I am missing some critical 
configuration item or doing something that disables it.

Anyone know where exactly what it does with keep-alive under what 
circumstances is documented? (Yes I know if I tackle the big job of 
understanding the source as if I wrote it I can figure it out) but I 
mean a "specification" that is a bit easier to get aquainted with :)

Thanks
PK

At 10:30 3/11/2007, you wrote:

>Well, "Connection: close" is supposed to cause the server to close the
>connection after the request has been fulfilled, but it looks like your
>experience is that TC closes the connection no matter what.
>
>What if you use a non-chunked request? You asked already and the
>response was that TC basically doesn't handle chunked requests.



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Keep Alive handling

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter,

Peter Kennard wrote:
> The "0" is the hex digint "Zero" the "terminal EOD" chunk is defined in
> HTTP1.1 as a chunk with a length of 0.  This is what terminates the data
> for the current request.

EOF? Right, I forgot that you were using chunked requests.

> I tried "explicitly" putting in the keep alive header, though it is
> deprecated in HTTP1.1 and is the default value if no header is
> supplied.  As expected this has no (different) effect.

Well, "Connection: close" is supposed to cause the server to close the
connection after the request has been fulfilled, but it looks like your
experience is that TC closes the connection no matter what.

What if you use a non-chunked request? You asked already and the
response was that TC basically doesn't handle chunked requests.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF9BKJ9CaO5/Lv0PARAuliAKCF9mpJPVp72ICgOeLwxNOhBjsVSgCePCZk
LKTxJt2y4DTJkumQQU2gDGs=
=tSB9
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Keep Alive handling

Posted by Peter Kennard <pe...@livingwork.com>.
At 19:50 3/10/2007, you wrote:

The "0" is the hex digint "Zero" the "terminal EOD" chunk is defined 
in HTTP1.1 as a chunk with a length of 0.  This is what terminates 
the data for the current request.

I tried "explicitly" putting in the keep alive header, though it is 
deprecated in HTTP1.1 and is the default value if no header is 
supplied.  As expected this has no (different) effect.

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Peter,
>
>Peter Kennard wrote:
> > for HTTP1.1 (in tomcat 6)
> >
> > Does tomcat handle keep alive (ie: keeping a connection open for
> > subsequent requests)
> >
> > If so under what circumstances is the connection closed (or kept open)?
> >
> > Sending chunked content, with a terminal "\r\n0\r\n" will cause the
> > connection to be disconnected.
> >
> > As does only a termainal "\r\n0"
>
>What is the "0" for?
>
>Are you sending the "connection: keep-alive" header?
>
>- -chris
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.4.7 (MingW32)
>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
>iD8DBQFF81Jm9CaO5/Lv0PARAjzxAJ4o4Er8VnA/qe8uOwzwkXfBYHOTIgCghtHu
>k1uq0TlPyEMa4oXX7clx5Rs=
>=wIZy
>-----END PGP SIGNATURE-----
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Keep Alive handling

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter,

Peter Kennard wrote:
> for HTTP1.1 (in tomcat 6)
> 
> Does tomcat handle keep alive (ie: keeping a connection open for
> subsequent requests)
> 
> If so under what circumstances is the connection closed (or kept open)?
> 
> Sending chunked content, with a terminal "\r\n0\r\n" will cause the
> connection to be disconnected.
> 
> As does only a termainal "\r\n0"

What is the "0" for?

Are you sending the "connection: keep-alive" header?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF81Jm9CaO5/Lv0PARAjzxAJ4o4Er8VnA/qe8uOwzwkXfBYHOTIgCghtHu
k1uq0TlPyEMa4oXX7clx5Rs=
=wIZy
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org