in reply to Should I just print my own HTTP headers?

You can. Just take care of that you have to output CGI headers, not http headers. This means in practice that you do not have to print a http status line (the one with a three-digit number), instead the webserver will print one as approperiate (200 normally, 302 in case you print a Location header so the server thinks it's a redirect), and that the server will correct the line endings of your header to crlfs. (Update: the server will also do the chunked encoding if you don't specify the Content-length, do the keepalive connection, and lots of other magical stuff I can't even imagine.)

The only header you are required to print is Content-type. Just search perlmonks for "Content-type", and you'll find lots of examples. (In case you wanted to write http requests by hand, you can do that too: in that case the only required header is Host.)

Update: it seems I didn't answer your question. Well, the CGI module does not output any headers, so it is safe to use it just the input part.

  • Comment on Re: Should I just print my own HTTP headers?