2016-01-07 13:19 GMT+03:00  <ma...@apache.org>:
> Author: markt
> Date: Thu Jan  7 10:19:14 2016
> New Revision: 1723506
>
> URL: http://svn.apache.org/viewvc?rev=1723506&view=rev
> Log:
> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58809
> Correctly recycle the cookies when mapping requests for parallel deployment
>
> Modified:
>     tomcat/tc8.0.x/trunk/   (props changed)
>     tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
>     tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/Request.java
>     tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml


> Modified: 
> tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1723506&r1=1723505&r2=1723506&view=diff
> ==============================================================================
> --- 
> tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 
> (original)
> +++ 
> tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 
> Thu Jan  7 10:19:14 2016
> @@ -951,8 +951,8 @@ public class CoyoteAdapter implements Ad
>                                  // Recycle cookies and session info in case 
> the
>                                  // correct context is configured with 
> different
>                                  // settings
> -                                req.getCookies().recycle();
>                                  request.recycleSessionInfo();
> +                                request.recycleCookieInfo(true);
>                              }
>                              break;
>                          }
>
> Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/Request.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/Request.java?rev=1723506&r1=1723505&r2=1723506&view=diff
> ==============================================================================
> --- tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/Request.java 
> (original)
> +++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/connector/Request.java Thu 
> Jan  7 10:19:14 2016
> @@ -477,8 +477,6 @@ public class Request
>              parts = null;
>          }
>          partsParseException = null;
> -        cookiesParsed = false;
> -        cookiesConverted = false;
>          locales.clear();
>          localesParsed = false;
>          secure = false;
> @@ -492,9 +490,9 @@ public class Request
>          attributes.clear();
>          sslAttributesParsed = false;
>          notes.clear();
> -        cookies = null;
>
>          recycleSessionInfo();
> +        recycleCookieInfo(false);
>
>          if (Globals.IS_SECURITY_ENABLED || Connector.RECYCLE_FACADES) {
>              parameterMap = new ParameterMap<>();
> @@ -554,6 +552,16 @@ public class Request
>      }
>
>
> +    protected void recycleCookieInfo(boolean recycleCoyote) {
> +        cookiesParsed = false;

Setting "cookiesParsed = false" means that processing of HTTP headers
will be repeated.

This second processing is possible only if
org.apache.tomcat.util.http.ServerCookie.PRESERVE_COOKIE_HEADER
system property is "true", but it is false by default.

http://tomcat.apache.org/tomcat-8.0-doc/config/systemprops.html


As this feature is needed, I think that setting has to be hard-coded as "true".


> +        cookiesConverted = false;
> +        cookies = null;
> +        if (recycleCoyote) {
> +            getCoyoteRequest().getCookies().recycle();
> +        }
> +    }
> +
> +
>      public boolean read() throws IOException {
>          return (inputBuffer.realReadBytes(null, 0, 0) > 0);
>      }
>

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

Reply via email to