W3C home > Mailing lists > Public > www-talk@w3.org > March to April 1995

Re: CGI PATH_TRANSLATED variable?

From: Christian Mogensen <mogens@cs.stanford.edu>
Date: Wed, 22 Mar 1995 19:43:28 -0800
Message-Id: <9503230343.AA23548@Xenon.Stanford.EDU>
To: phillips@cs.ubc.ca
Cc: Multiple recipients of list <www-talk@www10.w3.org>

Not quite.  If you have the serverroot at
  /var/web
and you have /htdocs and /cgi-bin  in the serverroot dir, and you have
two documents in /htdocs called  
  /foo.html and /baz/bar.html
then a request for /var/web/htdocs/foo.html looks like this
   http://yourserver/foo.html
and baz/bar.html is
   http://yourserver/baz/bar.html

Running through a gateway at
   http://yourserver/cgi-bin/script
the request using PATHINFO .html would be
   http://yourserver/cgi-bin/script/foo.html
      PATH_INFO= /foo.html
      PATH_TRANSLATED= /var/web/htdocs/foo.html

while
   http://yourserver/cgi-bin/script/baz/bar.html
      PATH_INFO= /baz/bar.html
      PATH_TRANSLATED= /var/web/htdocs/baz/bar.html

The advantage is that the server will do user-dir escaping for you, so
   http://yourserver/cgi-bin/script/~baz/bar.html
      PATH_INFO= /~baz/bar.html
      PATH_TRANSLATED= /u/baz/public_html/bar.html

This makes it easy to open the files and process them in the script.
Check  http://www-pcd.stanford.edu/mogens/script.html  for an example
of path_info use.

Christian
Received on Wednesday, 22 March 1995 22:43:41 UTC

This archive was generated by hypermail 2.4.0 : Monday, 20 January 2020 16:08:16 UTC