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 2021/07/27 08:10:00 UTC
[Bug 65466] New: content-type application/json default encoding
https://bz.apache.org/bugzilla/show_bug.cgi?id=65466
Bug ID: 65466
Summary: content-type application/json default encoding
Product: Tomcat 9
Version: 9.0.50
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: bernd.wahlen@k2interactive.de
Target Milestone: -----
when making a request with Content-Type:"application/json" (without encoding
parameter!) against tomcat (i reproduced it with postman), tomcat changes the
request to:
Content-Type:"application/json;charset=ISO-8859-1"
(in case of tomcat 9, i tried 9.0.50 and 9.0.48, tomcat 10 adding UTF-8
instead).
This is very strange to me, i think headers should not be modified at all.
And according to rfc, json default is UTF-8:
https://datatracker.ietf.org/doc/html/rfc7159
I could fix this by setting the charset of every request explicitly to UTF-8,
but if you have clients relying on the standard, it should not be necessary.
expected behavior:
- use the correct default, either the tomcat 10 way or leaving the header
unchanged.
- if not possible (e.g. backward compatibility?) add longer explanation to
migration guide if you have clients without json payload without charset that
they will break.
--
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 65466] content-type application/json default encoding
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65466
--- Comment #1 from Michael Osipov <mi...@apache.org> ---
Absolutely valid. Same request for HttpClient
https://issues.apache.org/jira/browse/HTTPCLIENT-2159.
--
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 65466] content-type application/json default encoding
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65466
--- Comment #6 from Michael Osipov <mi...@apache.org> ---
(In reply to qeepcologne from comment #5)
> thanks for checking, if i log it to tomcat access log via "%{Content-Type}i"
> header is unmodified, probably it happens later in spring magic.
It is very unlikely. Spring with Jackson never write a charset. You likely need
to debug this.
--
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 65466] content-type application/json default encoding
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65466
--- Comment #5 from qeepcologne <be...@k2interactive.de> ---
thanks for checking, if i log it to tomcat access log via "%{Content-Type}i"
header is unmodified, probably it happens later in spring magic.
--
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 65466] content-type application/json default encoding
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65466
--- Comment #2 from Mark Thomas <ma...@apache.org> ---
A little clarification is required. Do you mean HTTP request headers or HTTP
response headers? Assuming you mean HTTP response headers, how - exactly - is
the response created? Is this a static resource or is the response generated
dynamically?
--
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 65466] content-type application/json default encoding
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65466
--- Comment #3 from qeepcologne <be...@k2interactive.de> ---
request headers - i test request with postman and log headers via
org.springframework.web.filter.CommonsRequestLoggingFilter in the backend and
found it modified.
--
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 65466] content-type application/json default encoding
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65466
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Tomcat doesn't change any incoming headers. I've just confirmed this both with
a code review and with the following:
POST /examples/jsp/snp/snoop.jsp HTTP/1.1
Host: localhost:8080
Content-Type: application;json
Content-Length: 20
{
"key": value
}
The content type reported in the JSP was:
Content type: application;json
Best guess, some other component is wrapping the request.
--
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