At 10:55 PM 1/9/2003, Bill Barker wrote:
This is precisely what I'm seeing (and what caused the problem in the first place). The reported problem was that the request was missing a Content-Length header, but in reality the response was being sent with Content-Transfer-Encoding set to chunked (through mod_jk).> [The following describes my understanding of how Coyote works for Tomcat > 4.x and 5.x -- don't know about 3.3 or responding through a webserver > connector.] > > Tomcat sets the content length automatically in two circumstances: > > * Static files delivered by the default file-serving servlet > (because the length is known ahead of time from the directory > entry for that file)Same for Tomcat 3.3.x > > * When the response data is small enough to fit into the > response buffer, and has not been flushed yet, and no > content length header was set by the application. > > You can tweak the response buffer size (response.setBufferSize()) if you > want to increase the number of responses that fall into the second > category, but for anything longer than the response buffer size, it is > your responsibility to buffer the data you're generating so that you can > calculate and set the content length -- *before* writing any data to the > response. This also works with 3.3.x with the CoyoteConnector (which will first ship in release for 3.3.2, but is available now in the nightly, or by installing the Coyote jars in 3.3.1). With the Http10Connector, you don't want to know ;-). With mod_jk(2) this is not (currently) true. If the servlet doesn't specify content-length, then the response will be sent as chunked. In future versions, it is likely to change to conform with the above.
I would add to the above that the "standard" HttpConnector (org.apache.catalina.connector.http.HttpConnector) doesn't seem to behave this way. With a buffer size of 2048 (default) and a response size of 610, sending a request directly to Tomcat produces response headers like this:
HTTP/1.1 200 OK
Content-Type: text/xml
Date: Fri, 10 Jan 2003 18:45:28 GMT
Transfer-Encoding: chunked
Server: Apache Tomcat/4.0.3 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=6F80CF7B67D0621353A9C7C411C3DFBE;Path=/repeatorMonitor
Setting the attribute "allowChunking=false" produces response headers like this:
HTTP/1.1 200 OK
Content-Type: text/xml
Date: Fri, 10 Jan 2003 19:01:22 GMT
Server: Apache Tomcat/4.0.3 (HTTP/1.1 Connector)
Connection: close
Point being it looks like all my responses are being chunked unless I specifically disallow chunking (at which point I lose persistent connections). If this is a configuration issue on my machine, I'd appreciate any pointers. If this is unexpected behavior, I'll simplify the components and work on it some more. If you (or anyone) could tell me which of these are more likely, I'd be happy. :)
In case anyone's curious, requesting a static gif produces a non-chunked response like so:
HTTP/1.1 200 OK
Content-Type: image/gif
Content-Length: 47
Date: Fri, 10 Jan 2003 19:09:46 GMT
Server: Apache Tomcat/4.0.3 (HTTP/1.1 Connector)
Last-Modified: Mon, 26 Aug 2002 17:40:28 GMT
ETag: "47-1030383628000"
Thanks,
justin
____________________________________
Justin Ruthenbeck
Software Engineer, NextEngine Inc.
[EMAIL PROTECTED]
Confidential -
See http://www.nextengine.com/confidentiality.php
____________________________________
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
