Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: form to cgi to cgi

by chromatic (Archbishop)
on Jan 26, 2008 at 08:54 UTC ( #664438=note: print w/replies, xml ) Need Help??

in reply to Re: form to cgi to cgi
in thread form to cgi to cgi

print "content-type: text/html\n\n";

Most web browsers will probably accept that, but it's invalid HTTP. If you're going to use CGI anyway, why not:

print $cgi->header();

Replies are listed 'Best First'.
Re^3: form to cgi to cgi
by ikegami (Pope) on Jan 26, 2008 at 11:35 UTC

    Then it's fortunate his script is communicating using CGI (not HTTP) with a web server (not a browser).

    While the header CGI is defined as being an HTTP header, web servers have a long history of accepting "\n" as a CGI header line seperator. The CGI spec even mentions it allows the CGI header to be seperated from the CGI body by LF or by CRLF. It's up to the server to construct a valid HTTP response from that de-facto valid CGI request.

    Or if you're referring to the unusual text case, CGI/HTTP field names are case-insensitive (RFC2616 S4.2). Incidentally, so are media types and subtypes (RFC2616 S3.7).

    While using print $cgi->header(); is a great idea seeing as CGI is already in play, what his script does is by no means invalid.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://664438]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2018-06-22 21:40 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.