Version 9 of Tclhttpd Document Domain

Updated 2007-10-22 10:48:31 by hoffi

The Document domain (see Tclhttpd Domains) supports the delivery of mime-typed content derived from files to a browser.

Tclhttpd is surprisingly efficient at delivering files, because having located the content in a file system from a URL, it uses Tcl's fcopy command to simply deliver the content by means of the underlying Tcl Core (which is written in C.)

The Document domain also supports a wide variety of content translation and negotiation, including powerful templates (see TclHttpd Templates), substitution and caching.

An instance of a Document domain is associated with a document root, which is a directory within some tcl file system.


Pseudo Code Document Algorithm

  • Generate a path from the URL
  1. Translate URL suffix to file path relative to this Document domain's DocRoot
  2. Translate paths which specify personal home pages to absolute paths.
  • Get file content from path - these alternatives are tried in order
  1. Look for a fresh template which generates the desired file
  2. Look for an exact match for the requested file
  3. Negotiate an acceptable available alternative file and issue a redirect to it
  4. Pass off to the Tclhttpd cgi domain looking for a Cgi in the middle of the path
  • Transform and return content according to type
  1. a directory is handed off to the Dirlist module
  2. a file transformed by a proc Doc_$mimetype, or just returned verbatim if no such proc exists

Category Tclhttpd