Re: Question about dir_cgi.c and PATH_INFO]
* David J. Weller-Fahy <[EMAIL PROTECTED]> [2005-01-30 17:13 +0100]: > Ok, took a while to digest all this, and do some searching of my own. I > found two good references, one off of the site you provided [1], and one > I found on my own [2]. They both describe PATH_INFO and SCRIPT_NAME in > approximately the same way, but I guess I'm confused as to how the > script gets the follow-on path information. In example, for the > following URL: Helps if I include the references: [1]: http://hoohoo.ncsa.uiuc.edu/cgi/env.html [2]: http://www.perlfect.com/articles/cgi_env.shtml Sorry. Regards, -- dave [ please don't CC me ]
Re: Question about dir_cgi.c and PATH_INFO]
* Michiel Boland <[EMAIL PROTECTED]> [2005-01-24 17:50 +0100]: > >Thanks, it works wonderfully now! Question, though: Why should it use > >SCRIPT_NAME instead of PATH_INFO? Or, I guess, what was the purpose of > >PATH_INFO, why did SCRIPT_NAME take over, and where can I read more > >about that? > > I believe the story is roughly as follows. The CGI standard [1] > dictates that if you have a script, say, /cgi-bin/php, then anything > in the URL following that script is passed as PATH_INFO. Ok, that makes sense. > Now, the CGI standard was written at a time when the only CGI scripts > were of the form described above, where you had a dedicated directory > for scripts. This directory was mapped to a URL using ScriptAlias, or > whatever directive ncsa/cern/etc used. > > Today the /cgi-bin nonsense has mostly disappeared I think; nowadays > scripts are put in the same directory as viewable content, so one > would have just > >/hello-world.php > > instead of > >/cgi-bin/php/hello-world.php > > Now to make hello-world.php work the same one would set PATH_INFO to > /hello-world.php in both instances. IIS did this, so I copied that > behaviour. But it sort-of clashes with the CGI specification. Since > mathopd 1.5 is the first version that claims to support CGI properly I > decided to back this out. Also, apache does it this way, and by then I > no longer had anything to do with IIS. :) > > Hope this makes any sense. Ok, took a while to digest all this, and do some searching of my own. I found two good references, one off of the site you provided [1], and one I found on my own [2]. They both describe PATH_INFO and SCRIPT_NAME in approximately the same way, but I guess I'm confused as to how the script gets the follow-on path information. In example, for the following URL: http://weller-fahy.com/bleah/not/here.html Where the script 'index.php' is in /usr/local/www which is mapped to /. By your description PATH_INFO was used to set the virtual path to the script, not the follow on path information to be processed by the script, correct? In that case, especially now that SCRIPT_NAME contains the virtual path to the script, and PATH_INFO isn't used, how the heck is the script getting the followon path information? :? Regards, -- dave [ please don't CC me ]
Re: Question about dir_cgi.c and PATH_INFO]
Eek. The dir_cgi.c on the mathopd site is rather old. It should use SCRIPT_NAME, rather than PATH_INFO. I have replaced it. The new version should work ok. Thanks, it works wonderfully now! Question, though: Why should it use SCRIPT_NAME instead of PATH_INFO? Or, I guess, what was the purpose of PATH_INFO, why did SCRIPT_NAME take over, and where can I read more about that? I believe the story is roughly as follows. The CGI standard [1] dictates that if you have a script, say, /cgi-bin/php, then anything in the URL following that script is passed as PATH_INFO. Now, the CGI standard was written at a time when the only CGI scripts were of the form described above, where you had a dedicated directory for scripts. This directory was mapped to a URL using ScriptAlias, or whatever directive ncsa/cern/etc used. Today the /cgi-bin nonsense has mostly disappeared I think; nowadays scripts are put in the same directory as viewable content, so one would have just /hello-world.php instead of /cgi-bin/php/hello-world.php Now to make hello-world.php work the same one would set PATH_INFO to /hello-world.php in both instances. IIS did this, so I copied that behaviour. But it sort-of clashes with the CGI specification. Since mathopd 1.5 is the first version that claims to support CGI properly I decided to back this out. Also, apache does it this way, and by then I no longer had anything to do with IIS. :) Hope this makes any sense. References: [1] http://hoohoo.ncsa.uiuc.edu/cgi/ Cheers Michiel
[[email protected]: Re: Question about dir_cgi.c and PATH_INFO]
Sorry about that, Michiel, this was supposed to go to the list. Darn fingers. - Forwarded message from "David J. Weller-Fahy" <[EMAIL PROTECTED]> - From: "David J. Weller-Fahy" To: Michiel Boland Message-ID: <[EMAIL PROTECTED]> * Michiel Boland <[EMAIL PROTECTED]> [2005-01-20 09:31 +0100]: > Eek. The dir_cgi.c on the mathopd site is rather old. It should use > SCRIPT_NAME, rather than PATH_INFO. I have replaced it. The new version > should work ok. Thanks, it works wonderfully now! Question, though: Why should it use SCRIPT_NAME instead of PATH_INFO? Or, I guess, what was the purpose of PATH_INFO, why did SCRIPT_NAME take over, and where can I read more about that? I'm ignorant as to any standards that may apply, so if the information is in them, please feel free to RTFM me. ;] - End forwarded message - Regards, -- dave [ please don't CC me ]
Re: Question about dir_cgi.c and PATH_INFO
On Tue, 18 Jan 2005, David J. Weller-Fahy wrote: I'm using the dir_cgi.c file to generate a directory listing for various areas of my website. However, where it should list the path information (from the environment variable PATH_INFO), I'm getting nothing. Eek. The dir_cgi.c on the mathopd site is rather old. It should use SCRIPT_NAME, rather than PATH_INFO. I have replaced it. The new version should work ok. Cheers Michiel
