Click here to get back home

CGI Cookie Path Question

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
CGI Cookie Path Question Daniel Kaplan 12-26-2005
Posted by Daniel Kaplan on December 26, 2005, 10:53 am
Please log in for more thread options


Hello All,

All my cookies are created with the path set to "/" and everything was
working fine. The one and only way I set my cookies was the line below.
And I know I have it only once as I keep it in one of my function modules
and call it with a function call.

$q->redirect(-cookie=>$cookies,-uri=>$new_url);

Everything was peechy keen until I started using fullpaths for the $new_url
value (i.e. http://myserver/cgi-bin/loggedon.pl"). The cookie path stayed
the same, "/", but now I was no longer reading them. Once I went back to
calling my function with $new_url no longer having the path, just
"loggedon.pl", everything went back to normal.

I know changing the path within cookie affect who can and can't read them.
But as well, all my cookies are created through the same function call, and
the path is hardcoded to "/".

So it seems to me, that the path from COOKIE is being ignored, and being
replaced with the path from the URI.

Is anyone familiar with anything like this?

Thanks ahead,

Daniel




Posted by Gunnar Hjalmarsson on December 26, 2005, 7:00 pm
Please log in for more thread options


Daniel Kaplan wrote:
> All my cookies are created with the path set to "/" and everything was
> working fine. The one and only way I set my cookies was the line below.
> And I know I have it only once as I keep it in one of my function modules
> and call it with a function call.
>
> $q->redirect(-cookie=>$cookies,-uri=>$new_url);
>
> Everything was peechy keen until I started using fullpaths for the $new_url
> value (i.e. http://myserver/cgi-bin/loggedon.pl").

Are you hardcoding the domain as well? Maybe using something else but
'myserver', e.g. 'www.myserver'?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


Posted by Daniel Kaplan on December 26, 2005, 6:33 pm
Please log in for more thread options



> Are you hardcoding the domain as well? Maybe using something else but
> 'myserver', e.g. 'www.myserver'?

yes.... as long as I just say "NextScript.pl" and not
http://myswerver.com/cgi-bin/NextScript.pl everything is cool.

Very weird




Posted by Gunnar Hjalmarsson on December 27, 2005, 12:39 am
Please log in for more thread options


Daniel Kaplan wrote:
> Gunnar Hjalmarsson wrote:
>>Are you hardcoding the domain as well? Maybe using something else but
>>'myserver', e.g. 'www.myserver'?
>
> yes....

In that case, try

http://www.myserver.com/cgi-bin/NextScript.pl

> as long as I just say "NextScript.pl" and not
> http://myswerver.com/cgi-bin/NextScript.pl everything is cool.
>
> Very weird

Learn more about cookies at http://www.cookiecentral.com/

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


Posted by Daniel Kaplan on December 26, 2005, 6:54 pm
Please log in for more thread options



> In that case, try
>
> http://www.myserver.com/cgi-bin/NextScript.pl
>

I'll check it out, though I went and changed it all instances to relative
paths as opposed to absolute.

But am curious as to the cause, since from the documentation (as I read it)
does not mention that the path of the URI in calling redirect affects the
path of the cookie.




Similar ThreadsPosted
HTTP::Cookie won't store sent cookie March 17, 2005, 4:28 pm
Apache2::Cookie August 23, 2005, 12:52 am
Extract Session Cookie February 23, 2007, 3:29 am
mod_perl2 and APR::Request::Cookie error October 29, 2006, 3:22 pm
Perl module for cookie/logon/session management with Apache May 10, 2007, 12:40 pm
Why is nothing found in @INC path ?!?! April 21, 2006, 2:39 pm
skip path prune July 17, 2006, 12:34 pm
In SVG, persistent signs in path ? October 25, 2007, 7:20 pm
Graph Path Module April 14, 2008, 5:37 am
Getting Path of an external DLL in Perl: Inline C. October 2, 2005, 8:41 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap