Off the cuff my hunch is the leading . you're
supplying in the domain. You might want to
check the Netscape developer docs, as they are
the ones to have originally defined what a cookie is.
UPDATE
A paper on cookies.
Note the domain, not the cookie, has . # restrictions.
Also note that that leading . would cause problems
for people visting your site (assuming you have DNS entires for them)
as jplan.com and not www.jplan.com and foo.jplan.com
--
perl -pe "s/\b;([st])/'\1/mg"
| [reply] |
I tried without the .domain.com and it still does not work.
the code for these to programs can be run:
http://jplan.com/cgi-bin/ctb/setCookie.pl
http://jplan.com/cgi-bin/ctb/getCookie.pl
| [reply] [d/l] |
Well that setCookie is still setting the domain with a preceding .
You are also limiting access to the cookie to only setCookie by the path you are using.
HTTP/1.1 200 OK
Date: Wed, 16 Jan 2002 03:09:40 GMT
Server: Apache/1.3.19 (Unix) FrontPage/4.0.4.3
Set-Cookie: user=dummy; domain=.jplan.com; path=/cgi-bin/ctb/setCookie
+.pl
Set-Cookie: password=hispassword; domain=.jplan.com; path=/cgi-bin/ctb
+/setCookie.pl
Connection: close
Content-Type: text/html
--
perl -pe "s/\b;([st])/'\1/mg"
| [reply] [d/l] |
I wrote a client side program to write the cookie, and it succeeds, and my cgi get cookie works so the setCookie cgi program is still the problem.
ummmm..........
| [reply] |
Please tell me that you aren't really going to use cookies to store usernames and passwords. . .
-Any sufficiently advanced technology is indistinguishable from doubletalk.
| [reply] |
Oh yes, good one - and I was going to add, why are you using CGI but not using it?
#!/usr/bin/perl -w
use CGI ;
my $q = new CGI;
my $co_userid = $q->cookie(-name=>'user',
-value=>'dummy',
-domain=> '.jplan.com',
-path=> '/cgi-bin/') ;
my $co_password = $q->cookie(-name=>'password',
-value=>'hispassword',
-domain=> '.jplan.com',
-path=> '/cgi-bin/');
print $q->header(-cookie=>[$co_userid,$co_password]),
$q->start_html({-title => 'CTB Discussion Index',
-style => {'src'=>'../../ctb/css/header.c
+ss'},
-bgcolor => '#FFFFFF',
-topmargin => 2,
-marginheight => 2,
-leftmargin => 2,
-marginwidth => 2),
$q->p('Cookie is set'),
$q->br,
$q->end_html;
As for the password, I'd set a session ID instead, that expires after a certain length of time (store it in a text file or DB somewhere for later checking).
cLive ;-) | [reply] [d/l] |
I've had problems with cookies when a path is set, so you may try not defining a path. It's not required anyway, unless you plan on having many cookies from different parts of your site. Also, if that doesn't work, try it without the domain as well. I removed both on my local machine and it worked on NS just fine.
- Derek Soviak
| [reply] |
I found some code on this site and it solves my problem writes in bothe netscape and IE finally !!!!!!
#!/usr/bin/perl -w
use CGI;
use CGI::Carp (fatalsToBrowser);
use CGI::Cookie
$co = new CGI;
$cook = $co->cookie(
-name=>'ctbuser',
-path=>'/',
-expires=>'+1h',
-value=>'pixxadonut'
);
print $co->header(-cookie=>$cook);
print 'ok you set my cookie pal';
| [reply] [d/l] |
Hi there,
A couple of notes:
Have you tried the "warn before accepting a cookie" option in Netscape - it's often useful when debugging cookie problems?
In the header() function in CGI.pm, you could use the function "cookies" rather than "cookie" - I'm 98 percent certain that one is just the same as the other, but it's a style note.
davis | [reply] |
This code is sample code it has nothing to do with what I am actually doing with cookies so don't worry about the password.
And Yes I have been using the Netscape cookie notify when accepting cookies from the begining. I get the warning for everyone but me.
The activestate Perl docs state for the domain:
"2. domain
This is a partial or complete domain name for which the cookie is vali
+d. The browser will return the cookie to any host that matches the pa
+rtial domain name. For example, if you specify a domain name of ``.ca
+pricorn.com'', then Netscape will return the cookie to Web servers ru
+nning on any of the machines ``www.capricorn.com'', ``ftp.capricorn.c
+om'', ``feckless.capricorn.com'', etc. Domain names must contain at l
+east two periods to prevent attempts to match on top level domains li
+ke ``.edu''. If no domain is specified, then the browser will only re
+turn the cookie to servers on the host the cookie originated from.
So it looks liek I am following the spec, but I am going to eliminate both of these.
I also will try the all CGI module version I think Netscape does not like the hybrid approach, little touchy you know!
Thanks for the imput this has been driving me nutso!!!!
Dennis | [reply] [d/l] |