On 27/09/2014 14:24, Konstantin Kolinko wrote: > 2014-09-25 23:38 GMT+04:00 <ma...@apache.org>: >> Author: markt >> Date: Thu Sep 25 19:38:15 2014 >> New Revision: 1627619 >> >> URL: http://svn.apache.org/r1627619 >> Log: >> Refactor cookie parsing to make it more pluggable
<snip/> >> Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java >> URL: >> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1627619&r1=1627618&r2=1627619&view=diff >> ============================================================================== >> --- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original) >> +++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Thu Sep 25 >> 19:38:15 2014 >> @@ -84,10 +84,11 @@ import org.apache.tomcat.util.ExceptionU >> import org.apache.tomcat.util.buf.B2CConverter; >> import org.apache.tomcat.util.buf.ByteChunk; >> import org.apache.tomcat.util.buf.MessageBytes; >> -import org.apache.tomcat.util.http.Cookies; >> +import org.apache.tomcat.util.http.CookieProcessor; >> import org.apache.tomcat.util.http.FastHttpDateFormat; >> import org.apache.tomcat.util.http.Parameters; >> import org.apache.tomcat.util.http.ServerCookie; >> +import org.apache.tomcat.util.http.ServerCookies; >> import org.apache.tomcat.util.http.fileupload.FileItem; >> import org.apache.tomcat.util.http.fileupload.FileUploadBase; >> import >> org.apache.tomcat.util.http.fileupload.FileUploadBase.InvalidContentTypeException; >> @@ -283,12 +284,20 @@ public class Request >> >> >> /** >> - * Cookies parsed flag. >> + * Cookie headers parsed flag. Indicates that the cookie headers have >> been >> + * parsed into ServerCookies. >> */ >> protected boolean cookiesParsed = false; >> >> >> /** >> + * Cookie parsed flag. Indicates that the ServerCookies have been >> converted >> + * into user facing Cookie objects. >> + */ >> + protected boolean cookiesConverted = false; >> + >> + >> + /** >> * Secure flag. >> */ >> protected boolean secure = false; >> @@ -462,6 +471,7 @@ public class Request >> } >> partsParseException = null; >> cookiesParsed = false; >> + cookiesConverted = false; >> locales.clear(); >> localesParsed = false; >> secure = false; >> @@ -1668,7 +1678,7 @@ public class Request >> public void addCookie(Cookie cookie) { >> >> if (!cookiesParsed) { > > I think that the above condition shall also be changed to if > (!cookiesConverted). > > If we skip conversion here and convertCookies() method is called > later, it will overwrite cookies array with "cookies = new > Cookie[count];" so any cookies added here will be lost. Thanks. Fixed. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org