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 2009/09/11 16:56:58 UTC
DO NOT REPLY [Bug 47825] New: Setting Cookie with UTF-8 encoded
value gives ServletException for 5.5.26+
https://issues.apache.org/bugzilla/show_bug.cgi?id=47825
Summary: Setting Cookie with UTF-8 encoded value gives
ServletException for 5.5.26+
Product: Tomcat 5
Version: 5.5.26
Platform: PC
OS/Version: All
Status: NEW
Keywords: ErrorMessage
Severity: normal
Priority: P3
Component: Catalina
AssignedTo: dev@tomcat.apache.org
ReportedBy: daniel.unfried@u-net.de
--- Comment #0 from Daniel Unfried <da...@u-net.de> 2009-09-11 07:56:55 PDT ---
Created an attachment (id=24248)
simple Maven2 web project to reproduce the error
Trying to do
response.addCookie(new Cookie("cookie0", myData));
where myData is a UTF-8 String retrieved through request parameter, all 5.5
versions after and including 5.5.26 produce the following ServletException
error:
javax.servlet.ServletException: Control character in cookie value, consider
BASE64 encoding your value
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
The instructions from http://wiki.apache.org/tomcat/FAQ/CharacterEncoding to
handle encodings correctly state:
- Set URIEncoding="UTF-8" on your <Connector> in server.xml
- Use a character encoding filter with the default encoding set to UTF-8
- Change all your JSPs to set the correct Content-Type (use <%@page
contentType="mime/type; charset=UTF-8" %>)
Following these instructions I started out with vanilla installations of 5.25,
5.26, 5.27 and 5.28 on both Windows (Vista64) and Linux (Debian 5.0) using
jdk-1.5.0_12 with the only change from default configuration being the
URIEncoding set to UTF-8 in server.xml. By deploying the sample application
attached the error can be reproduced for 5.5.26+.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 47825] Setting Cookie with UTF-8 encoded value
gives ServletException for 5.5.26+
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47825
--- Comment #3 from Daniel Unfried <da...@u-net.de> 2009-09-11 08:10:46 PDT ---
But why did the exact same thing work on 5.5.25? Is this some non-standard
behavior? Is it just a coincidence it works? Would be great if you could shed
some more light.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 47825] Setting Cookie with UTF-8 encoded value
gives ServletException for 5.5.26+
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47825
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
--- Comment #2 from Mark Thomas <ma...@apache.org> 2009-09-11 16:05:00 BST ---
As the error message says, if you want to do that you'll need to encode the
data, eg using Base64.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 47825] Setting Cookie with UTF-8 encoded value
gives ServletException for 5.5.26+
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47825
--- Comment #4 from Mark Thomas <ma...@apache.org> 2009-09-11 16:18:20 BST ---
Cookie handling is now stricter. Non-compliant cookies will get rejected.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 47825] Setting Cookie with UTF-8 encoded value
gives ServletException for 5.5.26+
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47825
--- Comment #1 from Daniel Unfried <da...@u-net.de> 2009-09-11 07:58:42 PDT ---
Created an attachment (id=24249)
trace log
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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