[cs631apue] Question about CGI
Jan Schaumann
jschauma at stevens.edu
Wed Dec 12 10:11:34 EST 2012
Chao Cui <ccui1 at stevens.edu> wrote:
> $ pwd
> /home/jschauma
> $ sws -c ./sws/cgi-bin ./sws
>
> HTTP request absolute pathname
> ------------------------------------------------------------------------
> / /home/jschauma/sws/index.html (or directory listing)
> /cgi-bin/foo /home/jschauma/sws/cgi-bin/foo
>
> Above is a example you gave to us.
Ok, let's use that as the correct definition, then. :-) This is the way
that most other web servers handle this, too, so let's be consistent.
That is:
- a client request for a CGI must begin with "/cgi-bin"
- the remainder of the resource path given by the client is resolved
relative to the directory given to the server's "-c" flag
Examples (in addition to the above):
$ sws -c /var/www/cgi-bin /var/www/sws
HTTP request absolute pathname
------------------------------------------------------------------------
/ /var/www/sws/index.html (or directory listing)
/cgi-bin/foo /var/www/cgi-bin/foo
$ pwd
/tmp
$ sws -c ./dir ../usr/local/htdocs
HTTP request absolute pathname
------------------------------------------------------------------------
/dir /usr/local/htdocs/dir (or directory listing)
/cgi-bin/dir /tmp/dir/dir
/cgi-bin/subdir/file /tmp/subdir/file
I've updated the manual page accordingly.
I hope this clears up the confusion and makes things simpler.
-Jan
More information about the cs631apue
mailing list