Skip to content

Commit

Permalink
Handle the unlikely case where different versions of a web applicatio…
Browse files Browse the repository at this point in the history
…n are deployed with different session settings

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1713184 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Nov 7, 2015
1 parent 6fcc354 commit 83679b9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
6 changes: 4 additions & 2 deletions java/org/apache/catalina/connector/CoyoteAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,11 @@ protected boolean postParseRequest(org.apache.coyote.Request req, Request reques
// Reset mapping
request.getMappingData().recycle();
mapRequired = true;
// Recycle cookies in case correct context is
// configured with different settings
// Recycle cookies and session info in case the
// correct context is configured with different
// settings
req.getCookies().recycle();
request.recycleSessionInfo();
}
break;
}
Expand Down
30 changes: 18 additions & 12 deletions java/org/apache/catalina/connector/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,18 +468,7 @@ public void recycle() {
notes.clear();
cookies = null;

if (session != null) {
try {
session.endAccess();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.warn(sm.getString("coyoteRequest.sessionEndAccessFail"), t);
}
}
session = null;
requestedSessionCookie = false;
requestedSessionId = null;
requestedSessionURL = false;
recycleSessionInfo();

if (Globals.IS_SECURITY_ENABLED || Connector.RECYCLE_FACADES) {
parameterMap = new ParameterMap<>();
Expand Down Expand Up @@ -513,6 +502,23 @@ public void recycle() {
}


protected void recycleSessionInfo() {
if (session != null) {
try {
session.endAccess();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.warn(sm.getString("coyoteRequest.sessionEndAccessFail"), t);
}
}
session = null;
requestedSessionCookie = false;
requestedSessionId = null;
requestedSessionURL = false;
requestedSessionSSL = false;
}


// -------------------------------------------------------- Request Methods

/**
Expand Down

0 comments on commit 83679b9

Please sign in to comment.