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 2024/07/03 17:40:40 UTC

[Bug 69164] New: Exception "java.lang.IllegalArgumentException", due to: The Unicode character [木] outside the permitted range of 0 to 255

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

            Bug ID: 69164
           Summary: Exception "java.lang.IllegalArgumentException", due
                    to: The Unicode character [木] outside the permitted
                    range of 0 to 255
           Product: Tomcat 9
           Version: 9.0.84
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: meghatalathi02@gmail.com
  Target Milestone: -----

Overview: Tomcat removes the response header with unicode character [木] 
outside the permitted range of 0 to 255 in Tomcat versions (9.0.82 , 9.0.84
onwards)

Steps to Reproduce: 
Create a Java Servlet API and while returning response, add header as below
 "Last-Modified" : "木, 11 5月 2023 21:15:43 JST"


Actual Results: Tomcat remove the header before returning the response

03-Jul-2024 11:12:33.708 警告 [https-jsse-nio-443-exec-1]
org.apache.coyote.http11.Http11Processor.prepareResponse The HTTP response
header [Last-Modified] with value [木, 06 6月 2024 12:32:42 IST] has been removed
from the response because it is invalid
        java.lang.IllegalArgumentException: The Unicode character [木] at code
point [26,408] cannot be encoded as it is outside the permitted range of 0 to
255
                at
org.apache.tomcat.util.buf.MessageBytes.toBytesSimple(MessageBytes.java:286)
                at
org.apache.tomcat.util.buf.MessageBytes.toBytes(MessageBytes.java:255)
                at
org.apache.coyote.http11.Http11OutputBuffer.write(Http11OutputBuffer.java:394)
                at
org.apache.coyote.http11.Http11OutputBuffer.sendHeader(Http11OutputBuffer.java:372)
                at
org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1065)
                at
org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:379)
                at org.apache.coyote.Response.action(Response.java:211)
                at org.apache.coyote.Response.sendHeaders(Response.java:440)
                at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:292)
                at
org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:273)
                at
org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118)


Expected Results: While returning a response, the header value should be
returned as below
"Last-Modified" : "木, 11 5月 2023 21:15:43 JST"


Additional Information: Working in Apache Tomcat 9.0.35, 9.0.56

-- 
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 69164] Exception "java.lang.IllegalArgumentException", due to: The Unicode character [木] outside the permitted range of 0 to 255

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

--- Comment #5 from timothyjmills <th...@hotmail.com> ---
(In reply to Mark Thomas from comment #3)
> See bug 66196 https://amongusgame.io

Bug reports dealing with IllegalArgumentException in Tomcat are all related to
handling Unicode characters in HTTP response headers.

-- 
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 69164] Exception "java.lang.IllegalArgumentException", due to: The Unicode character [木] outside the permitted range of 0 to 255

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

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
See bug 66196

-- 
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 69164] Exception "java.lang.IllegalArgumentException", due to: The Unicode character [木] outside the permitted range of 0 to 255

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

--- Comment #2 from Megha Talathi <me...@gmail.com> ---
Thanks for the quick reply, Mark! That's helpful to know.

But still, my concern is not clear. Can you please help with this?

Concern:

The same code works in the lower version under Tomcat 9.x.x.
To be specific, it is working in Tomcat 9.0.35 and Tomcat 9.0.56.
i.e, the response header like the one below is sent:
"Last-Modified" : "木, 11 5月 2023 21:15:43 JST"

But I recently upgraded my Application to Tomcat 9.0.82 and Tomcat 9.0.84 with
the same configuration XML, and there it started giving errors.


So, does that mean in Tomcat 9.0.35 & Tomcat 9.0.56 does not check rules under
'RFC 9110, section 5.5'?

-- 
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 69164] Exception "java.lang.IllegalArgumentException", due to: The Unicode character [木] outside the permitted range of 0 to 255

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED
                 OS|                            |All

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
This is working as designed. See RFC 9110, section 5.5.

-- 
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 69164] Exception "java.lang.IllegalArgumentException", due to: The Unicode character [木] outside the permitted range of 0 to 255

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

--- Comment #4 from Megha Talathi <me...@gmail.com> ---
Thanks, Mark! That was insightful.

This means that, from Tomcat v9.0.71 onwards,  ''RFC 9110, section 5.5' rules
are applicable & below that are not applicable as of now.

So this answers my query.
That's the reason my code is working on Tomcat 9.0.35 and Tomcat 9.0.56,
whereas it is not working on Tomcat 9.0.82 and Tomcat 9.0.84.

-- 
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