tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maik Jablonski" <maik.jablon...@gmail.com>
Subject Cookies are broken in 6.0.16?
Date Sat, 09 Feb 2008 06:43:09 GMT
Hi,

I've just encountered that Cookies seem to be a little bit broken in
6.0.16. If you want to read a cookie which ends on one or more
equals-sign (=), the equals-signs are removed by Tomcat when the
cookie is read.

If you run the following example, you'll see, that the test_cookies
are stored correctly on the browser, but when read out by the next
request, the equals-signs are missing in the cookie-value.

Is it a bug or a "undocumented" change?

Cheers, Maik

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SimpleServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response) {
		for (Cookie cookie : request.getCookies()) {
			System.out.println(cookie.getName() + ":" + cookie.getValue());
		}
		response.addCookie(new Cookie("test_cookie1", "123="));
		response.addCookie(new Cookie("test_cookie2", "123=="));
		response.addCookie(new Cookie("test_cookie3", "123==="));
	}
}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message