Next: User interface
Up: Implementation issues
Previous: Publishing a directory
The file name extension of a particular
file usually determines the way in which a Web browser
interprets the file's content. For example,
a file that has a name ending with the extension ``.htm''
usually contains HTML.
Similarly a file that has a name ending with
the extension ``.jpg'' usually contains a JPEG image. The Publius URL
does not retain the file extension of the file it
represents. Therefore the Publius URL gives no hint to
the browser, or anyone else for that matter,
as to the type of file it points to. Indeed, this is the desired behavior
as we do not wish to give the hosting server the slightest
hint as to the type of content being hosted.
However, in order for the
browser to correctly interpret the byte
stream sent to it by the proxy, the proxy
must properly identify the type of data it is sending.
Therefore before publishing a file we prepend
the first three letters of the file's name extension
to the file. We prepend the three letter file extension rather
than the actual MIME type because MIME types are of
variable length (An alternative implementation could store the
actual MIME type prepended with two characters that
represented the length of the MIME type string).
The file is then published as described
in Section 3.2. When the proxy is ready to
send the requested file back to the browser
the three letter extension is removed from the file.
This three letter extension is used by the proxy
to determine an appropriate MIME
type for the document.
The MIME type is sent in an HTTP ``Content-type'' header.
If the three letter extension is not helpful in determining
the MIME type a default type of ``text/plain'' is
sent for text files. The default MIME type for binary files
is ``octet/stream''.
Next: User interface
Up: Implementation issues
Previous: Publishing a directory
Avi Rubin
2000-06-13