Re: what's a CGI to do?...

>...
>Let me paraphrase the problem.  NCSA httpd (and my server) allow a CGI
>to give a "local" Location: header that causes the server to process
>the resulting redirection without first sending anything to the client.
>Beyond that I think the "correct" behavior is undefined.  So I'm trying
>to define it.
>
>Some questions that come up are:
>
>1) What should the method be for the redirected request?
>(N.B.  I think the behavior should be consistent with what happens for a
>"full" URL that gets returned to a client.)

A "GET" method. It's the only useful behaviour; the CGI script has no means
for supplying content.

>2) If the method should indeed be POST, where does the content come from?
>(POST requires Content-Type and Content-Length headers.)

Logically, from the script that returned the Location: header. Unfortunately,
there is currently no way to arrange that.

>3) Should there be a way for a CGI to specify the method to use with a
>redirection?  If yes, only for local URLs, or for full ones, too?

You could do it for local URLs by having a Method: header, and taking
any content produced by the CGI script as input content for the redirected
request.

> 4) What environment should be passed to a CGI (like T2 above) that is
> reached via a redirection?
> (Here again, I think it should be the same as if a full URL got sent
> back to the client, and the client made a new request.)

Yes. That is what servers currently do on internal redirection. However, some
servers also pass the CGI variables for the original request prefixed by
REDIRECT_. e.g. Client requests http://foo.com/script?args
The server (perhaps because of script being a CGI script returning a
Location: /bar header) internally redirects this to the CGI script
http://foo.com/bar
then this script gets the environment variables
SCRIPT_NAME=/bar
QUERY_STRING=""
REDIRECT_SCRIPT_NAME=/script
REDIRECT_QUERY_STRING=args

 David.

Received on Thursday, 30 November 1995 12:28:41 UTC