in reply to Re: Using perl to set headers
in thread Using perl to set headers

Thanks,
I have a site that consists of mostly static pages with some dynamic scripts (cgi files written in perl). I Put the code I mentioned in an .htacces file (intending appache to add the header to all files). It adds the header to html files (so cookies are set and read properly with html with IE V6.0), but it is not adding it to my dynamic files. I have a
print "Content-type: text/html\n\n"
statement at the top of my script and I tried just adding the print
CP="NOI ADM DEV PSAi COM ..." policyref="/w3c/php.xml";
but that did not work. I am using vanilla CGI. I am just trying to add the privacy policy to the pages created by my script. Without the policy, there are no other special pieces to the header. I hope that was more helpful. Thanks

Replies are listed 'Best First'.
Re: Using perl to set headers
by jonadab (Parson) on Sep 11, 2003 at 04:28 UTC
    I have a print "Content-type: text/html\n\n" statement at the top of my script and I tried just adding the print CP="NOI ADM DEV PSAi COM ..." policyref="/w3c/php.xml";

    No, it wouldn't. You've already printed a blank line, so according to the HTTP spec, the headers are over. You need to insert your headers before the blank line that ends the headers.

    print "Content-type: text/html CP=\"NOI ADM DEV PSAi COM ...\" policyref=\"/w3c/php.xml\" \n";

    Also, I'm not sure about that formatting on those two headers. Shouldn't HTTP headers have colons followed by spaces instead of equal signs? I'm not familiar with the CP and policyref headers, but I was thinking all headers were formatted the same way, like in most internet protocols. If so, it should be more like this...

    print "Content-type: text/html CP: NOI ADM DEV PSAi COM ... policyref: /w3c/php.xml \n";

    $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
      Thanks for the info (I didn't know the blank line ends the headers). You are correct, I am using the colon as a seperator, I mistyped. My policy still does not work, but it accepts all the headers and now it is just a matter of making sure the headers are correct. Thank you.