[mod_python] Another sessions problem...

Dominique.Holzwarth at ch.delarue.com Dominique.Holzwarth at ch.delarue.com
Thu Mar 27 03:54:12 EDT 2008


Here's the "protocol" of what happen's when I call the "sessiontest1.py" and then click the button on the generated form:


http://dchbna0308/python/sessiontest1.py

GET /python/sessiontest1.py HTTP/1.1
Host: dchbna0308
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: pysid=5df5a82bc6780d5c9364619e0fe452f6

HTTP/1.x 200 OK
Date: Thu, 27 Mar 2008 07:42:28 GMT
Server: Apache/2.2.4 (Win32) mod_python/3.3.1 Python/2.5.1
Cache-Control: no-cache="set-cookie"
Set-Cookie: pysid=e97a4f4e71f967639a44fe260cfae9d8; path=/python/
Content-Length: 298
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
----------------------------------------------------------
http://dchbna0308/python/sessiontest2.py

POST /python/sessiontest2.py HTTP/1.1
Host: dchbna0308
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://dchbna0308/python/sessiontest1.py
Cookie: pysid=e97a4f4e71f967639a44fe260cfae9d8
Content-Type: application/x-www-form-urlencoded
Content-Length: 29
counter=1&new=2345&button=Add

HTTP/1.x 200 OK
Date: Thu, 27 Mar 2008 07:42:35 GMT
Server: Apache/2.2.4 (Win32) mod_python/3.3.1 Python/2.5.1
Cache-Control: no-cache="set-cookie"
Set-Cookie: pysid=20da3d07fa40e8d4399f627b422ddb93; path=/python/
Content-Length: 48
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain

If I understand it correct the server generates a cookie with the pysid=e97a4f4e71f967639a44fe260cfae9d8 and path=/python/. Then, when I hit the form button the POST message sends the cookie back with that same ID pysid=e97a4f4e71f967639a44fe260cfae9d8. The server then still creates a response (200 OK) with a NEW pysid=20da3d07fa40e8d4399f627b422ddb93...
So I personaly still don't get what could be wrong :-/

As for your question about other cookies. Yes, I probably HAVE other cookies stored because I already have done some session testing before (an 'easier' example which worked...). Is there a problem with having several cookies (from the same 'domain/localhost')?

Greetings
Dominique

-----Original Message-----
From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
Sent: Mittwoch, 26. März 2008 21:04
To: Holzwarth, Dominique (Berne Bauhaus)
Cc: mod_python at modpython.org
Subject: Re: [mod_python] Another sessions problem...

Inspect the value of the cookie in the browser, post it here. What is the path attribute associated with it? Do you perhaps have two cookies stored in the browser with different paths because of how you have configured mod_python? You can also use live headers extension in FireFox to see what the cookie header sent back in response is to validate it looks right.

Graham




More information about the Mod_python mailing list