This document describes the changes made to the software between the previous and current versions (see above). If you don't find something listed here, then it was not done in this timeframe, or it was not considered important enough to be mentioned. The following information is located here:
This code adds two new features to httpd: special treatment for the pseudo-mime-type application/x-type-map, and the MultiViews per-directory Option (which can be set in srm.conf, or in .htaccess files, as usual). These features are alternate user interfaces to what amounts to the same piece of code (in the new file http_mime_db.c) which implements the optional content negotiation portion of the HTTP protocol. Each of these features allows one of several files to satisfy a request, based on what the client says it's willing to accept; the differences are in the way the files are identified: *) A type map names the files explicitly *) In a MultiViews directory, the server does an implicit glob and chooses from among the results This code also adds a new pseudo-MIME type, text/x-server-processed-html3, which is treated as text/html;level=3 for purposes of content negotiation, and as server-side-included HTML elsewhere. TYPE MAPS: A type map is a document which is typed by the server (using its normal suffix-based mechanisms) as application/x-type-map. The syntax of these files follows Roy's "meta/http" idea. Note that to use this feature, you've got to have an AddType someplace which defines a file suffix as application/x-type-map; the easiest thing may be to stick a AddType application/x-type-map var in srm.conf. A separate patch will follow with suggested config file changes. These files have an entry for each available variant; these entries consist of contiguous RFC822-format header lines. Entries for different variants are separated by blank lines. Blank lines are illegal within an entry. It is conventional to begin a map file with an entry for the combined entity as a whole, e.g., URI: foo; vary="type,language" URI: foo.en.html Content-type: text/html; level=2 Content-language: en URI: foo.fr.html Content-type: text/html; level=2 Content-language: fr If the variants have different qualities, that may be indicated by the "qs" parameter, as in this picture (available as jpeg, gif, or ASCII-art): URI: foo; vary="type,language" URI: foo.jpeg Content-type: image/jpeg; qs=0.8 URI: foo.gif Content-type: image/gif; qs=0.5 URI: foo.txt Content-type: text/plain; qs=0.01 The full list of headers recognized is: URI: uri of the file containing the variant (of the given media type, encoded with the given content encoding). These are interpreted as URLs relative to the map file; they must be on the same server (!), and they must refer to files to which the client would be granted access if they were to be requsted directly. Content-type: media type --- level may be specified, along with "qs" Content-language: self-explanatory Content-encoding: self-explanatory Content-length: If present, this number is used for comparison against any client-specified maxbytes's for the media type. (If absent, and the client specified maxbytes (more formally, "mxb"), the server will stat the file to find a value). MULTIVIEWS: This is a per-directory option, meaning it can be set with an Options directive within asection in access.conf, or (if AllowOverride is properly set) in .htaccess files. Note that Options All does not set MultiViews; you have to ask for it by name. (Fixing this is a one-line change to httpd.h). The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, /some/dir has MultiViews enabled, and /some/dir/foo does *not* exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same MIME types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's accept: headers, and forwards them along. This applies to searches for the file named by the DirectoryIndex directive, if the server is trying to index a directory; if the configuration files specify DirectoryIndex index then the server will arbitrate between index.html and index.html3 if both are present. If neither are present, and index.cgi is there, the server will run it. If one of the files found by the globbing is a CGI script, it's not obvious what should happen. My code gives that case gets special treatment --- if the request was a POST, or a GET with QUERY_ARGS or PATH_INFO, the script is given an extremely high quality rating, and generally invoked; otherwise it is given an extremely low quality rating, which generally causes one of the other views (if any) to be retrieved. This is the only jiggering of quality ratings done by the MultiViews code; aside from that, all Qualities in the synthesized type maps are 1.0. Note that this machinery only comes into play if the file which the user attempted to retrieve does *not* exist by that name; if it does, it is simply retrieved as usual. (So, someone who actually asks for 'foo.jpeg', as opposed to 'foo', never gets foo.gif). FILES CHANGED: http_mime_db.c --- new file. http_mime.c --- pass Accept-foo headers to http_mime_db for perusal; new force_header function intended to be called from http_mime_db.c to add headers to control caching (though this functionality has been diked out of mime_db for the moment at Roy's request); strip parms off returned content-types, since *no* extant browser presently understands them. http_get.c --- special treatment for new magic types (map file, HTML3-with-includes); code to invoke MultiViews when appropriate. http_request.c --- if looking for a *.cgi script in POST (or PUT, DELETE), try MultiViews if we don't find it by the name we are given. http_access.c --- if we're looking for symlinks, and lstat() fails, there's no symlink there, so don't fail the access check. (Otherwise, when the URL names a search to be done with MultiViews, the lstat() fails because the file isn't there, and access is denied with a 403). http_config.c --- new configuration directive, MultiViews. http_include.c --- process includes in included HTML3-with-includes. httpd.h --- new access control option (OPT_MULTI); new magic types; prototypes for various functions Makefile --- http_mime_db.o added to objs