[cs631apue] CGI SCRIPT_NAME and PATH_INFO

Jan Schaumann jschauma at stevens.edu
Thu Dec 3 22:33:06 EST 2015


Lingfei Hu <lhu4 at stevens.edu> wrote:
> As for rfc3875, we need to parse SCRIPT_NAME and PATH_INFO from Script-URI.
> But I am confused with how to split these two vars from URI.
> 
> e.g. , given  /cgi-bin/env.pl/foo/bar,
> One possible splitting is SCRIPT_NAME = "/cgi-bin/env.pl"  PATH_INFO = "
> /foo/bar"

That is the correct interpretation.  SCRIPT_NAME points to the path of
the script that is executed, PATH_INFO to the remainder (if any).

You can compare:

https://www.cs.stevens.edu/~jschauma/cgi-bin/env.cgi/dir/env.cgi
and
https://www.cs.stevens.edu/~jschauma/cgi-bin/dir/env.cgi/foo/bar

-Jan


More information about the cs631apue mailing list