tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars George <l...@worldlingo.com>
Subject Problem with Cookie.getValue
Date Sun, 19 May 2002 23:27:01 GMT
Hi,

I hope this is the right place to ask this question. If not I apologize and
please let me know where to post this instead.

I am confused about the setting and getting of cookie values. Could someone
of the dev team shed a light on this? The question is, why does the cookie
value get urlencoded before setting the header field but NOT decoded when
receiving the cookie back?

Here it's set (CookieTools.java):

        buf.append(URLEncoder.encode(name));
        buf.append("=");
        maybeQuote(version, buf, URLEncoder.encode(value));

And in Cookies.java it is read like this

        sc.getValue().setBytes( bytes, startValue, endValue-startValue);

and set later in Ajp13Request.java

        ServerCookie scookie = cookies.getCookie(j);
        Cookie cookie = new Cookie(scookie.getName().toString(),
scookie.getValue().toString());

We realized this change of behaviour after changing from JServ to Tomcat
4.0.3. Suddenly or code failed because we set a cookie value that was used
to come back as-is. With Tomcat it now comes back urlencoded and we have to
place a decode around each Cookie.getValue() call to fix our code.

Is this intentionally?

Kind regards,

Lars

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


Mime
View raw message