[cs631apue] Question about CGI

ccui1 ccui1 at stevens.edu
Tue Dec 11 18:59:10 EST 2012


Hi,

I have a question about how I can determine whether a quest is a CGI 
request or normal request

For example:

We run the server like ./sws -c ./usr/cgi_bin ./usr/htdocs
(1) Assume we both have ./usr/cgi_bin/foo and ./usr/htdocs/cgi_bin/foo
These are two different files with the same name.
One is under cgi_root, the other is under server root.

Now a quest like GET /cgi_bin/foo come to the server.
How can we handle this request? We process it as a cgi request or a 
normal request?

If we run the server like ./sws -c ./usr/cgi/test ./usr/htdocs

Now the cgi root is ./usr/cgi/test.

What kind of request is regarded as a CGI request?

Do we need to force that a request staring with a /cgi_bin/ is a CGI 
request?
For example:
If the cgi root is ./usr/cgi/test/
The request is GET /cgi_bin/dir/subdir/file HTTP/1.0.
We finally regard the request as ./usr/cgi/test/dir/subdir/file.

Or We compare the request path with the CGI root.

If this is the case, what if there are the same path and files under 
both CGI root and the server root. Which one will be used?

(2)Will the -l and -d options override each other?
If both of these two flags are given, which one will effect the server?

Thanks
-- 
Chao Cui
phone: 518-505-0519
Master of Computer Science Candidate
Stevens Institute of Technology


More information about the cs631apue mailing list