Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Problem setting cookie using CGI::Cookie

by kutsu (Priest)
on Jun 05, 2003 at 13:59 UTC ( #263332=note: print w/replies, xml ) Need Help??


in reply to Re: Problem setting cookie using CGI::Cookie
in thread Problem setting cookie using CGI::Cookie

All &url does is print

<!DOCTYPE html PUBLIC "..."> <html> ... <link rel="stylesheet" type="text/css" href="/sheet.css" media="screen +">
Will this cause a problem.

Sorry about not saying this sooner, but I couldn't get to the PC this was on until this morning

"Pain is weakness leaving the body, I find myself in pain everyday" -me

Replies are listed 'Best First'.
Re: Re: Re: Problem setting cookie using CGI::Cookie
by chromatic (Archbishop) on Jun 05, 2003 at 16:29 UTC

    Yes, that will cause a problem if you print it before the header. The header must come first. The cookie must be in the header. If you print anything else first and the web browser accepts the cookie, it's broken.

    Your web server may add headers automatically if you don't print the headers first, but your cookie won't be set if that happens. You get one chance to print the HTTP header and the cookie must be in that header.

    I'm being very explicit here because this trips up a lot of people.

    As far as the domain issue, you may need to add a trailing period. I seem to recall that CGI::Cookie checks to see if the domain name contains two periods. Does it work better with example.com.?

      The cookie is only sent if the username is correct and ,if it is, does print before the header. Maybe my script doesn't show that well?

      "Pain is weakness leaving the body, I find myself in pain everyday" -me

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://263332]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2023-11-30 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?