The problem with .htaccess files is their high cost in performance. These files are hierarchical, i.e. if I have /foo/.htaccess, the configuration specified in this file must be applied to /foo/bar/file as well as /foo/file. This requires the server to perform a linear search of pathnames, looking for .htaccess files. In this case, it would need to look for /.htaccess, /foo/.htaccess, and /foo/bar/.htaccess. These searches can add tremendous overhead to the response process.
However, the ability to control server functions on a per-directory basis is a useful feature. We have taken this idea and extended it in the Netscape servers in our object-oriented paradigm.
We define object-oriented to mean a method of grouping server documents and resources (such as CGI programs and parsed HTML documents) into logical objects. These groupings or objects can then have sets of configuration parameters applied to them.
Grouping of these server resources is accomplished through two methods. The first is based on the filesystem pathname of the file or directory. In conjunction with a wildcard expression parser, the Netscape servers allows groupings of files and directories similar to many extended UNIX shells such as Paul Falstad's zsh. Using this grouping, both directories, files, or sets of directories and sets of files may be specified using a wildcard expression. Example: /foo/dir/* would apply to everything inside the directory /foo/dir. If we wanted to protect only two CGI files inside that directory, we could use /foo/dir/(script1|script2).cgi.
The second method is a bit more complex than the first but allows for some relatively powerful concepts. Using this method, configuration groups are given names which uniquely identify them. Using I>name translation functions, a named object is associated with a directory or set of directories. An example is creating a named object which applies to all users' home directories. Another example is using a configuration grouping to cause certain directories to hold only CGI programs (similar to the Exec rule in CERN httpd).
Assume a former NCSA httpd user who now uses Netscape Server software has a leftover directory called /usr/local/etc/httpd/cgi-bin. Now assume that the user wants to apply access control to a set of scripts inside that directory but allow free access to others.
When responding to a request for one of the protected scripts, the server must construct a set of three objects: the default object that controls the behavior of the entire server, the CGI object that causes every file within the directory to be treated as a CGI program regardless of its type, and the object that protects the set of scripts within that directory from access by unauthorized hosts.
Once the server has constructed this set of objects from its database, it must apply the configuration they specify to the script being requested and take the proper action.
Corporate Sales: 415/528-2555; Personal Sales: 415/528-3777
Copyright © 1996 Netscape Communications Corporation
If you have any questions, please visit Customer Service.