[cs631apue] Request like /~jschama/
Jan Schaumann
jschauma at stevens.edu
Wed Dec 5 23:29:40 EST 2012
ccui1 <ccui1 at stevens.edu> wrote:
> The request like
> /~jschama/ we transfer that to /home/jschama/sws/.
>
> If we get a request like /~jschama/testdir/ we transfer that into
> /home/jschama/sws/testdir/.
>
> Does that means when we get such kind of request, we find the files or
> directories under /home/jschama/sws/?
Correct.
> What if we get a request like
> /~jschama/../testdir/file ?
Here, you are attempting to go one directory above the ~jschauma
directory, ie /testdir/file. This is then resolved relative to the
servers document root just as if the request had been for
"/testdir/file".
> Shall we just pick the requested file name and find the same file name
> under ./usr/htdocs/ ?
If your server was invoked with "./usr/htdocs" as the document root to
serve content from, yes.
> Why do our web server support such kind of request?
> If I run this server, it means others can see the information in my
> personal folder.
Correct. If you decide to run a web server serving the contents of a
specific directory under your home directory, then other people can
access contents of that specific directory under your home directory.
> How can that be useful for a web server?
Think about it. How do you think the course website works?
http://www.cs.stevens.edu/~jschauma/631/
If we want to allow different users on a system to have their own
websites with content they control, we can't have that data in the
document root -- otherwise, all users on the systems would require write
access there.
For example, if you would like to have your own website under
http://www.cs.stevens.edu/~ccui/, then you can create a directory named
"cs_html" on linux-lab.cs.stevens.edu, and any files you place there
will be available on the above URL. Here, the web server uses the
"cs_html" directory to perform the per-user translation.
-Jan
More information about the cs631apue
mailing list