You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Remy Maucherat <re...@apache.org> on 2002/06/04 00:29:18 UTC

Re: [3.3.2-dev] CoyoteConnector2 invalid headers

> When using CC2 with TC 3.3.2, every request sets both
> the content-length and the transfer-encoding, which
> is not only wrong, but can confuse some clients.
>
> Content-Length: 9
> Transfer-Encoding: chunked
>
> The 4.0 org.apache.catalina.connector.http.HttpConnector
> does not have this problem.  Any quick ideas while I dig
> through the code?

This does not happen with 4.0.x and 4.1.x when using Coyote. I have no idea
why it would happen in 3.3, esp when looking at the code in the
Http11Processor class.

        int contentLength = response.getContentLength();
        if (contentLength != -1) {
            outputBuffer.addActiveFilter
                (outputFilters[Constants.IDENTITY_FILTER]);
            contentDelimitation = true;
        } else {
            if (entityBody && http11) {
                outputBuffer.addActiveFilter
                    (outputFilters[Constants.CHUNKED_FILTER]);
                contentDelimitation = true;
                response.addHeader("Transfer-Encoding", "chunked");
            }
        }

That's the only place where the Transfer-Encoding header is set.

There could be a problem when setting the "Content-Length" header directly
in
the MimeHeaders object (in that case, the content length of the response
won't
get updated).

Either:
- coyote.Response.getContentLength should check for a "Content-Length"
header
if the int value is -1.
- the Tomcat 3 adapter should properly call coyote.Response.setContentLength
the same way the Tomcat 4 adapter does.

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>