https://bz.apache.org/bugzilla/show_bug.cgi?id=67670

--- Comment #2 from Konstantin Kolinko <knst.koli...@gmail.com> ---
(In reply to M McClain from comment #0)

> diff --git a/java/org/apache/coyote/http11/Http11Processor.java
> b/java/org/apache/coyote/http11/Http11Processor.java
> index aab2290407..ac531ad105 100644
> --- a/java/org/apache/coyote/http11/Http11Processor.java
> +++ b/java/org/apache/coyote/http11/Http11Processor.java
> @@ -914,12 +914,6 @@ public class Http11Processor extends AbstractProcessor {
> ...
>  
> -        // Check for compression
> -        boolean useCompression = false;
> -        if (entityBody && sendfileData == null) {
> -            useCompression = protocol.useCompression(request, response);
> -        }
> ...
> @@ -956,8 +950,11 @@ public class Http11Processor extends AbstractProcessor {

The lines between the two chunks in the diff above in Http11Processor are
responsible for setting the "Content-Length" header.

>930:        long contentLength = response.getContentLengthLong();
>...
>937:        } else if (contentLength != -1) {
>938:            headers.setValue("Content-Length").setLong(contentLength);


The "protocol.useCompression(request, response)" call goes down to
org.apache.coyote.CompressionConfig#useCompression(...) that does

>        // Compressed content length is unknown so mark it as such.
>        response.setContentLength(-1);
>        // Configure the content encoding for compressed content
>        responseHeaders.setValue("Content-Encoding").setString("gzip");

As the "useCompression" was moved by that commit, line 930 no longer sees the
correct contentLength value.


Note: The workaround for this issue is to turn off compression on a Connector.
(Remove the "compression" attribute from a <Connector> element, or set it to
"off").

https://tomcat.apache.org/tomcat-9.0-doc/config/http.html#Standard_Implementation

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to