Bug 28971 - problems if root-context and application-context sets cookies
Summary: problems if root-context and application-context sets cookies
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.0.24
Hardware: Other other
: P3 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-14 09:33 UTC by Mario Ivankovits
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Extract the package in the Tomcat installation folder (6.05 KB, application/octet-stream)
2004-05-14 14:43 UTC, Remy Maucherat
Details
Extract the package in the Tomcat installation folder (zip format) (6.81 KB, application/octet-stream)
2004-05-14 14:44 UTC, Remy Maucherat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Ivankovits 2004-05-14 09:33:15 UTC
I am not sure if this is a new bug (i have used tomcat4 for now and the .24
release is my first try to move to tomcat5).

Tomcat (now) sets two cookies - one for the root-context and one for the
application context - say (/opsjs).

Now on every request two cookies are sent to tomcat - one session-id for the
root context and one for the application-context. But it looks like tomcat cant
handle this case - maybe only the first cookie is processed and this do not
match to the cookie-list for the application-context (just an idea) - so a new
session is started and a new cookie sent to the browser.

I have had to disable the cookies on the root context.
<Context path="" docBase="ROOT" debug="0" cookies="false"/> 

Then the application works like expected - only one cookie is sent.

The definition of the application context is:
<Context path="/opsjs"
        docBase="/u/opsj"
        crossContext="false"
        debug="0"
        reloadable="false"
        trusted="false" >
...

Since another user experienced the same problem i decided to enter this (new)
behaviour as critical.
Comment 1 Remy Maucherat 2004-05-14 11:20:41 UTC
This is now fixed.
Comment 2 Remy Maucherat 2004-05-14 11:22:28 UTC
  Index: CoyoteAdapter.java
  ===================================================================
  RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- CoyoteAdapter.java	28 Apr 2004 22:05:10 -0000	1.25
  +++ CoyoteAdapter.java	14 May 2004 11:00:25 -0000	1.26
  @@ -295,6 +295,9 @@
               return false;
           }
   
  +        // Parse session Id
  +        parseSessionCookiesId(req, request);
  +
           return true;
       }
   
  @@ -352,6 +355,14 @@
               request.setRequestedSessionId(null);
               request.setRequestedSessionURL(false);
           }
  +
  +    }
  +
  +
  +    /**
  +     * Parse session id in URL.
  +     */
  +    protected void parseSessionCookiesId(Request req, CoyoteRequest request) {
   
           // Parse session id from cookies
           Cookies serverCookies = req.getCookies();
Comment 3 Remy Maucherat 2004-05-14 14:43:28 UTC
Created attachment 11548 [details]
Extract the package in the Tomcat installation folder
Comment 4 Remy Maucherat 2004-05-14 14:44:07 UTC
Created attachment 11549 [details]
Extract the package in the Tomcat installation folder (zip format)