Loading ...
Sorry, an error occurred while loading the content.

about http headers and cookies...

Expand Messages
  • Adrian Stovall
    Upon looking at the cookie faq, I see the following (and ignore my last post, please). normally you write an http header like so: Content-type: text/html n n
    Message 1 of 1 , Oct 11, 2001
    • 0 Attachment
      Upon looking at the cookie faq, I see the following (and ignore my last
      post, please). normally you write an http header like so:

      Content-type: text/html\n\n

      the second \n tells the user-agent that the header is done.

      if you send this instead:

      Content-type: text/html\n
      Set-Cookie: $cookie\n\n

      you have a header that includes the cookie.

      <snip>
      from the unofficial cookie faq

      4.3 Creating cookies with PERL

      As with most HTTP-related processes in PERL, cookies are set by writing an
      actual header to the response for an HTTP request. Most PERL programmers are
      used to writing headers like the following:



      Content-type: text/html
      This is a MIME header that explains that the content following is text-based
      HTML code. Similarly, we could write the cookie header directly:



      Content-type: text/html
      Set-Cookie: foo=bar; path=/; expires=Mon, 01-Jan-2001 00:00:00 GMT
      Here, an HTML page would follow after a cookie has been set.

      Another very popular HTTP header used in PERL is Location. Be aware that
      Location is best placed as the last header in a group:



      Content-type: text/html
      Set-Cookie: foo=bar; path=/; expires=Mon, 01-Jan-2001 00:00:00 GMT
      Location: http://www.mysever.com

      </snip>

      >
      >print "Set-Cookie: $cookie\n";
      >print "Content-type: text/html\n\n";
      >
      >I can't take away the previous text/html and the cookie
      >setting one won't
      >work without it.
      >if I remove the later one, it prints the cookie contents to screen.
      >
      >But with the two in there, one of them gets printed to the
      >browser like so:
      >Content-type: text/html
      >In the top corner...(and the cookie doesn't get set.)
      >
      >So my question is this,, how can I reset the header so that
      >the cookie gets
      >set and
      >all is well... does that make sense???
      >
      >
      >kindest regards
      >
      >Frank
      >
      >
      >
      >
      >Your use of Yahoo! Groups is subject to
      http://docs.yahoo.com/info/terms/
    Your message has been successfully submitted and would be delivered to recipients shortly.