You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "w1ida (via GitHub)" <gi...@apache.org> on 2023/11/01 12:11:38 UTC

[PR] Fix explicit chunked encoding specification [tomcat]

w1ida opened a new pull request, #676:
URL: https://github.com/apache/tomcat/pull/676

   Summary:
   This commit fixes a bug in the code related to handling chunked transfer encoding. The original code only handled chunked transfer encoding when http11 was true, entityBody was true, and connectionClosePresent was false. However, this did not take into account the case where the request headers indicated chunked transfer encoding.
   
   The modified code now includes a check for isChunked(headers) in addition to the existing conditions. This ensures that chunked transfer encoding is correctly handled when all the specified conditions are met, as well as when the request headers indicate chunked transfer encoding.
   
   Detailed Explanation:
   
   The original code snippet did not consider the situation where the request headers explicitly specified chunked transfer encoding. This resulted in a bug where chunked transfer encoding was not handled correctly.
   example: 
   javax.servlet.http.HttpServletResponse#setHeader("Transfer-encoding","chunked");
   javax.servlet.http.HttpServletResponse#setHeader("Connection","close");
   
   The modification addresses this issue by introducing a call to isChunked(headers) as an additional condition. This ensures that chunked transfer encoding is handled correctly when all the conditions (http11, entityBody, connectionClosePresent) are met, or when the request headers indicate chunked transfer encoding.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix explicit chunked encoding specification [tomcat]

Posted by "markt-asf (via GitHub)" <gi...@apache.org>.
markt-asf commented on PR #676:
URL: https://github.com/apache/tomcat/pull/676#issuecomment-1790213186

   No, this PR will not be applied. Applications should not be setting the Transfer-Encoding header. Or the Connection header for that matter.
   
   If you want to strongly suggest to the container that chunked encoding should be used,  set the headers (with no Content-Length) and then flush the response before writing the response body.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix explicit chunked encoding specification [tomcat]

Posted by "markt-asf (via GitHub)" <gi...@apache.org>.
markt-asf closed pull request #676: Fix explicit chunked encoding specification
URL: https://github.com/apache/tomcat/pull/676


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix explicit chunked encoding specification [tomcat]

Posted by "w1ida (via GitHub)" <gi...@apache.org>.
w1ida commented on PR #676:
URL: https://github.com/apache/tomcat/pull/676#issuecomment-1789983590

   > The description for the PR confuses request and response. It appears from the code that this PR relates to the response.
   > 
   > This PR will not be applied. Whether or not to chunk the response is a container decision, not an application decision.
   
   Thank you for pointing out the confusion caused by my previous message. I want to clarify that both the PR description and the code modification specifically address the issue with the response header, not the request. To demonstrate this, I have created a [demo](https://github.com/w1ida/tomcat-chunked-bug-demo) that reproduces the problem and showcases the accurate solution for explicit chunked encoding specification in the response. Would you kindly consider reopening the PR based on the accurate commit message and the accompanying demo?
   
   **please see https://github.com/w1ida/tomcat-chunked-bug-demo**


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix explicit chunked encoding specification [tomcat]

Posted by "markt-asf (via GitHub)" <gi...@apache.org>.
markt-asf commented on PR #676:
URL: https://github.com/apache/tomcat/pull/676#issuecomment-1788896749

   The description for the PR confuses request and response. It appears from the code that this PR relates to the response.
   
   This PR will not be applied. Whether or not to chunk the response is a container decision, not an application decision.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org