http



Last revision July 20, 2004

A Web server using the HyperText Transfer Protocol to serve HTML documents. This is the most common type of service accessed via the Web.

Requests for http service always talk to a special server process and require no username or password in the hostname field.

The filepathname field for http service is interpreted as a pathname relative to the "home" directory for the http service, which is configured by the system manager. For example, on pangea, the "home" directory for the http service is /WWW. Thus, for example, the URL:

http://pangea.stanford.edu/computing/index.html

specifies a file pathname computing/index.html which is relative to /WWW, or, in absolute terms, is resolved as the Unix path /WWW/computing/index.html.

For http servers on Unix systems, there is a convention that if the file path name field starts with a tilde character (~) followed by a login account name, that is, ~username, this refers to a specific subdirectory within the Unix home directory of the Unix user username. On pangea, this has been configured to be the subdirectory WWW. So, for example, the URL:

http://pangea.stanford.edu/~username/index.html

is referring to the file index.html within the WWW subdirectory of the home directory of the user username. As the home directory of the username account on pangea is /home/sysop/username, this URL file path name is resolved to be the Unix path

/home/sysop/username/WWW/index.html

If the filepathname field for an http service request is simply a directory, rather than a specific file, the http server will look for a specific index file within the directory. On pangea, the http server has been configured to look for the file named index.html. So, if you want to create an index or table of contents to a set of files in a directory, the simplest way is to create that index with the filename index.html, and then the URL can simply be the name of the directory.

If a directory referenced by a filepathname does not contain an index file, then the http server will create and present a simple list of links to the files within the directory.

The filepathname field for http service requests can include an optional "anchor" mark which denotes where in the document the browser should start its display (see definitions of HTML <a> tag, above). Simply add a hash mark (#) character followed by the desired anchor name to the end of the file path name.

When specifying URLs for http service, if the new file is on the same server as the document that is linking to it, then the service or resource type and hostname fields may be omitted. For example, in the computing subdirectory of the http server home directory on pangea, there is the file index.html which links to the file computing/network/security.html on the same server. When defining the link with an <a> tag in the security.html file, service type and hostname can be omitted from the URL. In this case, the file path name stands by itself and is called a "relative" URL. It will be resolved as a path specification relative to the directory of the file making the link, not to the home directory of the http server. In this example, you could link from computing/index.html to computing/network/security.html with either the complete URL

http://pangea.stanford.edu/computing/network/security.html

or with the relative one

network/security.html

The relative form of URL is preferred for groups of related files, because then if you move the files together to a new directory on the server, all their internal links to each other will still work.

For http service, the filepathname field can actually refer to a script (program) that is to be run, rather than to a simple file to be displayed. For security reasons, most Web servers are configured so that only scripts or programs from a particular system directory can be run. This keeps users from accidentally (or on purpose) allowing random programs to be run from their personal Web pages, which could be a security hole that lets crackers onto the system. On pangea, this script directory is /local/etc/httpd/cgi-bin. Contact the System Manager if you would like to add a script or program to this directory.

Comments or Questions?