in reply to Re: Re: A Picture A Day
in thread A Picture A Day

Thanks for the clarification -- even CGI.pm's redirect() method doesn't print the status line:
perl -MCGI -e 'print CGI->new({})->redirect("/foo/b ar.cgi");'
gives:
Status: 302 Moved
location: /foo/bar.cgi

This doesn't apply to nph CGI's, correct?

I didn't know that. Thanks

Replies are listed 'Best First'.
Re: Re: Re: Re: A Picture A Day
by Juerd (Abbot) on Dec 19, 2001 at 21:09 UTC
    For nph (non-parsable-headers, or something like that) CGI's, you need to construct all headers yourself, giving full freedom over what is being sent. With normal CGI, the _server_ interprets your Status-header, and will use it instead of its default "200" (OK) status => the Status header is not sent to the user agent.
    With a nph CGI, you need to construct the first line of the response yourself.

    # Normal CGI (The Status line is optional, the server will try to be i +ntelligent and guess it) Status: 302 Found Location: foo <blank line> # NPH CGI HTTP/1.1 302 Found Location: foo <blank line>

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$