https://bz.apache.org/bugzilla/show_bug.cgi?id=65201
Bug ID: 65201
Summary: Setting both response headers "Transfer-Encoding:
chunked" and "Connection: Close" results in an empty
response
Product: Tomcat 9
Version: 9.0.44
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Servlet
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -----
During the analysis of a potential bug in the spring framework
(https://github.com/spring-projects/spring-framework/issues/24699) it was found
that the Tomcat servlet implementation seems to close connections too soon when
two response headers are set.
Transfer-Encoding: chunked
Connection: Close
The problem could be reproduced by using pure servlet api using tomcat 9.0.44
```
public class MyServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setStatus(500);
resp.setHeader("Transfer-Encoding", "chunked");
resp.setHeader("Connection", "close");
resp.getOutputStream().write('{');
}
}
```
Querying such an endpoint via curl results in some broken empty response.
```
curl http://localhost:8000/api/some/resource
curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding
```
See original comment for more details:
https://github.com/spring-projects/spring-framework/issues/24699#issuecomment-600307198
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]