Skip Menu |

This queue is for tickets about the CGI-SSI CPAN distribution.

Report information
The Basics
Id: 12059
Status: resolved
Priority: 0/
Queue: CGI-SSI

People
Owner: james [...] bitperfect.com
Requestors: dsmith [...] avitar.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.82
Fixed in: (no value)



Subject: Cookies from domain are not read.
If you have a file that is parsed with CGI::SSI any cookies that are stored in the users browser are not passed to any scripts/includes that are within the parsed file. Example: A cookie named: 'mycookie' (value 'John Doe') is set for '.mydomain.com' (path is '/', not secure, expires in a hour). Script will always print 'Stranger' by error. A parsed file includes the includes: Hello <!--#include virtual="cgi-bin/printcookie.cgi"--> ,<BR>How are you. printcookie.cgi: use CGI::Cookie; print "Content-type: text/html\n\n"; print GetCookie('mycookie'); sub GetCookie{ my($CookieName)=$_[0]; my($Data) = 'Stranger'; my(%cookies) = fetch CGI::Cookie; foreach (keys %cookies) { if($cookies{$CookieName}){ $Data = $cookies{$CookieName}->value; last; } } return $Data; }
[guest - Tue Mar 29 16:53:59 2005]: Show quoted text
> If you have a file that is parsed with CGI::SSI any cookies that are > stored in the users browser are not passed to any scripts/includes > that are within the parsed file.
Hello and Thank You for Your Feedback, I've recently uploaded a new version (v0.85) to the CPAN. There is now the ability to control your own cookies. I feel that this is the best solution to this issue. Here's why: When a browser requests a page, it does not provide all of the information it has on each cookie to the web server. Information such as path, domain, and secure are left out. So any CGI::SSI script would have to guess as to most of the parameters of the cookie in order to pass it along the chain. Since these things can't be known, it's better to err on the side of caution and not pass them along by default. Besides, each cookie has a specific reason for existing, and that reason should dictate whether or not the cookie is passed along. Now, you can handle cookies however you like, according to your application and business logic, like so: You can either pass an option to new(): COOKIE_JAR => $HTTP_Cookies_obj, ... or you can set the cookies in the jar on the fly using the new cookie_jar() method: my $jar = $ssi->cookie_jar($HTTP_Cookies_obj); # arg optional ... so that's it. Please let me know if there's anything else to be done with this. Thanks Again, James Tolley