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 2026/07/15 07:53:03 UTC
[Bug 70144] New: Tomcat Embedded doesn't work with encoded `\`
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Bug ID: 70144
Summary: Tomcat Embedded doesn't work with encoded `\`
Product: Tomcat 11
Version: 11.0.23
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: boris_petrov@live.com
Target Milestone: -------
The report is for version 11.0.24 but it's not in the versions list.
I've updated my app from Tomcat 9 (latest) to Tomcat 11 (latest). An
integration test started failing - it opens a page with `%5C` (encoded `\`) in
the URL. That leads to a 400 error page shown from Tomcat.
Note this happens only in the embedded Tomcat. When I run it with the "normal"
Tomcat it works fine. Also, in Tomcat 9 there is no such problem.
This is my configuration, not that it should matter:
tomcat.connector.add_upgrade_protocol(http_2_protocol) # this will create the
default connector
tomcat.connector.encoded_solidus_handling =
EncodedSolidusHandling::DECODE.to_string
tomcat.connector.set_property('SSLEnabled', true.to_s)
tomcat.connector.set_property('relaxedPathChars', '^{}[]<>\|"')
tomcat.connector.set_property('useVirtualThreads', true.to_s)
I haven't specified:
tomcat.connector.encoded_reverse_solidus_handling =
EncodedSolidusHandling::DECODE.to_string
But according to the documentation this should be the default value.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #6 from Boris Petrov <bo...@live.com> ---
Sorry, Ruby allows `\` to not be *ESCAPED* in a single-quote string.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #5 from Boris Petrov <bo...@live.com> ---
Sorry, should have been more specific.
I use JRuby for my integration tests and this is Ruby code - and JRuby allows
calling `A.setXXX(YYY)` methods as property setters - `A.XXX = YYY`. There is a
method `Connector.setEncodedSolidusHandling` - which is being called by
`connector.encoded_solidus_handling =
EncodedSolidusHandling::DECODE.to_string`. For `SSLEnabled`, `relaxedPathChars`
and `useVirtualThreads` there are no specific methods so I just use
`setProperty` (again, JRuby allows this to be called as `set_property` as is
Ruby's convention for method naming).
The `\` is in the path, not a query string. And yes, Ruby allows `\` to not be
quoted in a single-quote string.
In any case, as I mentioned, this same unchanged code works fine when using
9.0.120. It breaks when I use 11.0.24. Only the `\` case - the other characters
work fine.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
Is the \ in URI's path or the query string?
This configuration style isn't familiar to me. What language is it? Do you need
to escape the backslash in the quoted string containing the relaxed characters?
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #12 from Mark Thomas <ma...@apache.org> ---
Thanks for pointing out the error in the 9.0.x docs. It does indeed look like
an incorrect back-port from 10.1.x. The 9.0.x docs have been corrected for
9.0.121 onwards.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #11 from Boris Petrov <bo...@live.com> ---
OK, I'm not sure what I've tested before but using `setAllowBackslash` worked
now and fixed my problem. And that's a new setting which doesn't exist in
Tomcat 9 so that's why it worked before. Thanks for the information and sorry
for the confusion!
Just a note about your documentation - in the Tomcat 9 docs:
https://tomcat.apache.org/tomcat-9.0-doc/config/http.html
In `encodedReverseSolidusHandling` there is a reference to `allowBackslash` but
it's otherwise missing from that page. It's probably a copy-paste error from
the docs in Tomcat 10/11. You might want to fix that.
Thanks again!
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Boris Petrov <bo...@live.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |WORKSFORME
Status|NEW |RESOLVED
--- Comment #7 from Mark Thomas <ma...@apache.org> ---
Confirmed working as expected with a test case.
Note that if the property exists on the Connector you must use the property
specific setter. setProperty() (as documented in the Javadoc) only works for
properties on the protocol handler.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #2 from Boris Petrov <bo...@live.com> ---
Nope, doesn't help. Also, as I mentioned, the problem is ONLY with the embedded
Tomcat. The other one works fine.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Christopher Schultz <ch...@christopherschultz.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #4 from Christopher Schultz <ch...@christopherschultz.net> ---
> tomcat.connector.encoded_solidus_handling =
> EncodedSolidusHandling::DECODE.to_string
> tomcat.connector.set_property('SSLEnabled', true.to_s)
Why are these specified in different ways: ".property = value" versus
".set_property('name', 'value')"?
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Boris Petrov <bo...@live.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |boris_petrov@live.com
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Christopher Schultz <ch...@christopherschultz.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|11.0.23 |11.0.24
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |INVALID
--- Comment #10 from Mark Thomas <ma...@apache.org> ---
Confirmed invalid using the provided test case.
There is no behavioural difference between the standard Tomcat package and the
embedded form. It is the same classes packaged differently. If you are seeing a
difference in behaviour then you have configured them differently.
To repeat my comment from almost a month ago - you need to set allowBackslash
to true on the Connector (directly, not via setProperty()). That is required
for 10.1.x and 11.0.x. For 9.0.x you have to set a system property.
If you require further configuration assistance, the users mailing list is the
correct venue to ask follow-up questions.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #1 from Mark Thomas <ma...@apache.org> ---
You need allowBackslash="true" as well.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
Boris Petrov <bo...@live.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|WORKSFORME |FIXED
--- Comment #8 from Boris Petrov <bo...@live.com> ---
Hi Mark, thanks for taking the time. My problem still stands, however. This
URL:
https://localhost:8081/integration-tests/search/%22F%5C%22%22
Used to work fine in Tomcat 9.0.120. Upgrading to 11.0.24 leads to a `HTTP
Status 400 – Bad Request` Tomcat page for that URL.
Are you saying that with these settings that I've shown you can open such a
URL? Again - using the EMBEDDED Tomcat - it is what seems to have the problem.
--
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 70144] Tomcat Embedded doesn't work with encoded `\`
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=70144
--- Comment #9 from Remy Maucherat <re...@apache.org> ---
Here is the test case that was added:
https://github.com/apache/tomcat/commit/9362c7d8b8ea230412d96424b946ebfe1eeee8bd
It includes the correct embedded API use. Feel free to expand it to help us
reproduce the issue if needed.
--
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