Re: Trouble with Ajax and Session

2009-06-19 Thread Roland Bock

Hi,

not sure if the original post ever made it past the moderators.

Anyway, the problem seems to be fixed now, after upgrading from the 
cake-version provided by Ubuntu-8.04 (1.2.0.5875~prebeta) to cake 1.2.3.

Regards,

Roland

Roland B wrote:
> Hi,
> 
> I have a web application using cakephp-1.2 and jQuery-1.2.6.. Ajax
> calls are
> being made to dynamically fetch more data from cake. My problem is
> that the
> ajax requests invalidate the current session if Security.level is set
> to
> high. It works fine with medium.
> 
> After searching the web for similar cases (there seem to be a lot, but
> I
> found no fitting solution), I assume that it is related to the session
> cookie. So I looked via LifeHttpHeaders what happens:
> 
> The page itself is accompanied by the following cookies:
> REQUEST:
> [...]
> Cookie: EHE=207b97c1c992e56e2ccb89534b902f12
> 
> RESPONSE:
> HTTP/1.x 200 OK
> Date: Tue, 16 Jun 2009 09:13:34 GMT
> Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
> mod_ssl/2.2.8 OpenSSL/0.9.8g
> X-Powered-By: PHP/5.2.4-2ubuntu5.6
> Set-Cookie: EHE=deleted; expires=Mon, 16-Jun-2008 09:13:33 GMT; path=/
> Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
> Set-Cookie: EHE=207b97c1c992e56e2ccb89534b902f12; path=/
> Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
> 
> While building, the page, an ajax request is fired:
> REQUEST:
> [...]
> Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8
> 
> RESPONSE:
> HTTP/1.x 302 Found
> Date: Tue, 16 Jun 2009 09:13:35 GMT
> Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
> mod_ssl/2.2.8 OpenSSL/0.9.8g
> X-Powered-By: PHP/5.2.4-2ubuntu5.6
> Set-Cookie: EHE=deleted; expires=Mon, 16-Jun-2008 09:13:34 GMT; path=/
> Set-Cookie: EHE=cc062e4139634958cf0e874faf2bc573; path=/
> Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
> Set-Cookie: EHE=cc062e4139634958cf0e874faf2bc573; path=/
> 
> The redirect is sending Ajax to the login page.
> 
> The cookie's name is defined in core.php:
> Configure::write('Session.cookie', 'EHE');
> 
> I wonder two things:
> 
> a) if Ajax sends the right cookie, why does it get the login page?
> b) why is the session cookie being sent 4 times per request?
> 
> Any idea how to fix the Ajax/session problem?
> 
> Thank you very much in advance,
> 
> Roland
> 
> > 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Trouble with Ajax and Session

2009-06-16 Thread Roland B

Hi,

I have a web application using cakephp-1.2 and jQuery-1.2.6.. Ajax
calls are
being made to dynamically fetch more data from cake. My problem is
that the
ajax requests invalidate the current session if Security.level is set
to
high. It works fine with medium.

After searching the web for similar cases (there seem to be a lot, but
I
found no fitting solution), I assume that it is related to the session
cookie. So I looked via LifeHttpHeaders what happens:

The page itself is accompanied by the following cookies:
REQUEST:
[...]
Cookie: EHE=207b97c1c992e56e2ccb89534b902f12

RESPONSE:
HTTP/1.x 200 OK
Date: Tue, 16 Jun 2009 09:13:34 GMT
Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
mod_ssl/2.2.8 OpenSSL/0.9.8g
X-Powered-By: PHP/5.2.4-2ubuntu5.6
Set-Cookie: EHE=deleted; expires=Mon, 16-Jun-2008 09:13:33 GMT; path=/
Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
Set-Cookie: EHE=207b97c1c992e56e2ccb89534b902f12; path=/
Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/

While building, the page, an ajax request is fired:
REQUEST:
[...]
Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8

RESPONSE:
HTTP/1.x 302 Found
Date: Tue, 16 Jun 2009 09:13:35 GMT
Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
mod_ssl/2.2.8 OpenSSL/0.9.8g
X-Powered-By: PHP/5.2.4-2ubuntu5.6
Set-Cookie: EHE=deleted; expires=Mon, 16-Jun-2008 09:13:34 GMT; path=/
Set-Cookie: EHE=cc062e4139634958cf0e874faf2bc573; path=/
Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
Set-Cookie: EHE=cc062e4139634958cf0e874faf2bc573; path=/

The redirect is sending Ajax to the login page.

The cookie's name is defined in core.php:
Configure::write('Session.cookie', 'EHE');

I wonder two things:

a) if Ajax sends the right cookie, why does it get the login page?
b) why is the session cookie being sent 4 times per request?

Any idea how to fix the Ajax/session problem?

Thank you very much in advance,

Roland

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---