CGI Musing

Right now (Feb. 25, 1994), there are some ambiguities in the Common Gateway Interface. Rob McCool has some test cases that work fine, but they don't address things like how escaping in the URL should affect things. Here's a test and what I believe should happen.

Here, PATH_INFO should be ``/path%2Finfo+more'', not ``/path/info more'':

NCSA server:
My server:

The server should not be un-escaping PATH_INFO -- it can lead to ambiguities as seen above. Besides that, it breaks an important property that should be spelled out in the CGI specification. When the client transmits a non-query ``GET uri'' to a server the CGI script will know that ``$SCRIPT_NAME$PATH_INFO'' is identical to ``uri'' Additionally, ``http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO'' should be a valid URL which is a reference to the document being returned. If the request was a query, append ``?$QUERY_STRING'' and the property should still hold.

My test script should show you this. Try these:

Modulo port defaults and host name aliases, the test script should show exactly what your browser shows for the document URL.

Note the messiness and assumptions in composing a full URL from the variables. I propose a $SERVER_ADDRESS environment variable for CGI/1.1 which will allow the full URL to be recovered with $SERVER_ADDRESS$SCRIPT_NAME$PATH_INFO[?$QUERY_STRING]. This nicely abstracts the access protocol and is much cleaner.

-- George Phillips