You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2020/03/22 16:06:35 UTC

[Bug 64255] New: tomcat-embed:chunked responses with header 'connetion:close' are damaged

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

            Bug ID: 64255
           Summary: tomcat-embed:chunked responses with header
                    'connetion:close' are damaged
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet
          Assignee: dev@tomcat.apache.org
          Reporter: taojiaen@gmail.com
  Target Milestone: -----

version:9.0.31


code segment is here

        Tomcat.addServlet(ctx, "hello", new HttpServlet() {

            private static final long serialVersionUID = -8721082143781719844L;

            @Override
            protected void doGet(HttpServletRequest req, HttpServletResponse
resp)
                throws IOException {
                resp.setStatus(200);
                resp.setHeader("Transfer-Encoding", "chunked");
                resp.setHeader("Connection", "close");
                resp.getOutputStream().write('{');
                resp.getOutputStream().flush();
            }
        });

and use curl there will be

curl 'http://localhost:8089/hello'
curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding


the compele code is here

https://github.com/taojiaenx/tomcat-chunk-error.git

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


[Bug 64255] tomcat-embed:chunked responses with header 'connetion:close' are damaged

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64255

--- Comment #2 from taojiaen <ta...@gmail.com> ---
(In reply to Mark Thomas from comment #1)
> If the application takes responsibility for setting the chunked encoding
> header it also has to take responsibility sending for a correctly encoded
> body.
> 
> Generally, it is much simpler to let the container handle chunked encoding.

Even If I change the body into a simple character or other string, it also
damaged.How can I solve this problem ?

I just send a simple character is it not a correctly body?and It worked well
when I use jetty or undertow, when I remove the header "connetion:close", it
also worked well.

Have I do some illegal operation?

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


[Bug 64255] tomcat-embed:chunked responses with header 'connetion:close' are damaged

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64255

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
If the application takes responsibility for setting the chunked encoding header
it also has to take responsibility sending for a correctly encoded body.

Generally, it is much simpler to let the container handle chunked encoding.

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


[Bug 64255] tomcat-embed:chunked responses with header 'connetion:close' are damaged

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64255

taojiaen <ta...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |INFORMATIONPROVIDED

--- Comment #3 from taojiaen <ta...@gmail.com> ---
(In reply to Mark Thomas from comment #1)
> If the application takes responsibility for setting the chunked encoding
> header it also has to take responsibility sending for a correctly encoded
> body.
> 
> Generally, it is much simpler to let the container handle chunked encoding.

thx for reply a really want to know what happend, I have worked it on for weeks
and have no idea about it.
the related bug is reported on github
https://github.com/spring-cloud/spring-cloud-gateway/issues/1600#event-3129620407
https://github.com/spring-projects/spring-framework/issues/24699#issuecomment-600742824

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


[Bug 64255] tomcat-embed:chunked responses with header 'connetion:close' are damaged

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64255

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INFORMATIONPROVIDED         |INVALID

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Bugzilla is not a support forum.

If you want to ask questions, use the Tomcat users mailing list.

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