On 05.03.2009 16:16, Mahesh Seshan wrote:
Hello,
I can obtain the content-length of a HTTP Servlet Request when the
Content-Length header is added by the client. However, when the
Transfer-encoding is chunked, how do I programatically obtain the
content length ?
You can't without consuming the body.
The task at hand for me is to prevent a HTTP client from issuing a
request that has a huge payload that could pose a resource risk on the
HTTP server.
Exactly that's the reason, why there is no easy way to get the length.
Whatever component that could provide you with that information would
need to read all of the body (and buffer it for your later use) in order
to measure its length.
Chunked encoding works with chunks, individual chunks usually are small
and the protocol tells us, how big the next chunk is, but we never know
how big the size of all chunks together is.
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org