Perl CGI Response codes other than 200 OK

Don Russell fedora at drussell.dnsalias.com
Mon Mar 13 17:16:40 UTC 2006


I've spent most of yesterday trying to solve this by searching google... :-(

I'm trying to use HTTP::Response to create a response when my perl cgi
program is run.

I keep getting "malformed header" errors:
... malformed header from script. Bad header=HTTP/1.1 304 (Not Modified)

I set all the headers and possible content then finally issue
	print $r->as_string();

Where $r is my HTTP::Response item.

So I can see exactly what is sent, I also use sendmail to send that
exact thing as an e-mail message.

%mailmsg = (
	...
	Message => "---\n" . $r-> as_string() . "---\n",
	);
sendmail %mailmsg;

and this is what I get in e-mail.... looks OK to me.

---
HTTP/1.1 304 (Not Modified)
Connection: close
Date: Mon, 13 Mar 2006 16:11:49 GMT
Expires: Mon, 10 Apr 2006 16:11:49 GMT


---

How can I return various HTTP result codes to clients? Not everything is
"200 OK" simple.

I've tried including content-type: headers too, with no affect.
All I can find on google is to print the content-type header first,
followed by a blank line... that would just make all MY headers part of
the response BODY... the client would see a 200 OK status code. :-(

Thanks,
Don Russell




More information about the fedora-list mailing list