diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java index f5a8d7dbb..a34c30977 100644 --- a/java/org/apache/catalina/connector/CoyoteAdapter.java +++ b/java/org/apache/catalina/connector/CoyoteAdapter.java @@ -951,8 +951,8 @@ protected boolean postParseRequest(org.apache.coyote.Request req, Request reques // Recycle cookies and session info in case the // correct context is configured with different // settings - req.getCookies().recycle(); request.recycleSessionInfo(); + request.recycleCookieInfo(true); } break; } diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index e4ce8b144..c9f3ac67f 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -477,8 +477,6 @@ public void recycle() { parts = null; } partsParseException = null; - cookiesParsed = false; - cookiesConverted = false; locales.clear(); localesParsed = false; secure = false; @@ -492,9 +490,9 @@ public void recycle() { 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 @@ protected void recycleSessionInfo() { } + protected void recycleCookieInfo(boolean recycleCoyote) { + cookiesParsed = false; + cookiesConverted = false; + cookies = null; + if (recycleCoyote) { + getCoyoteRequest().getCookies().recycle(); + } + } + + public boolean read() throws IOException { return (inputBuffer.realReadBytes(null, 0, 0) > 0); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 9cd962c26..d37559f7b 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -114,6 +114,10 @@ Fix declaration of localPort attribute of Connector MBean: it is read-only. (kkolinko) + + 58809/bug>: Correctly recycle cookies when mapping requests for + parallel deployment. (markt) +