Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
server
.gitignore
README
form.sig
form.sml
http-date.sml
pack-compat.sml
static-server.sml
web-util.sig
web-util.sml
web.cm
web.mlb
web.sml

README

Stilts
------

This provides the core of the Stilts web infrastructure. The following modues
are defined:

- Web

  Core web request types.

  The html datatype is provided to allow some type safety when dealing with
both strings, which may contain any data and must not be passed directly to
a browser, and HTML snippets, which are only generated by certain pieces of
"safe" code.

  Since one may want to return content of any type (even binary data),
the response type is defined using a Word8Vector.vector rather than a string
or HTML datatype.

- WebUtil / WEB_UTIL

  Useful functions for processing Web requests and responses.

  This contains a large collection of helper functions; they are documented
indiviually in web-util.sml.


- Form / FORM

  HTTP form handling; extracting variables from GET and POST requests.

  An HTTP form does not quite correspond to a mapping between values in the
usual sense. Input elements are generally named uniquely, but some types of
control (checkboxes, multi-select boxes) will produce multiple values for the
same key; this results in encodings like key=value1&key=value2&...

  However, most of the time, one is only interested in one value (if any) for
a key. The Form structure implements this by defining a form as a mapping from
a string key to a _list_ of values, and providing helper functions to return
the last-specifed value (if any) as well as all values. For flexibility, the
backing ORD_MAP structure is also made available.

-----------------------------------------
Notes on the prepath/postpath abstraction
-----------------------------------------

  Web.request records carry two pieces of path information, the "prepath" and
"postpath". The concatenation of the two represents the full incoming path
for the request without a leading slash. The division between the two sections
represents the division between paths in the URL hierarchy "leading two" an 
application versus those "within" the application. The precise semantics of
"application" here are intentionally somewhat loose. 

  For example, one could use WebUtil.dispatch to build a hierarchy of what some
frameworks refer to as controllers. Alternately, an app could pattern-match
on the whole of its postpath, and not have to worry about where it is available
on the actual Web server.

  At the Stilts <-> Web server boundary, prepath and postpath correspond
roughly to the CGI SCRIPT_NAME and PATH_INFO variables, respectively. However,
servers are not entirely consistent in how they provide these; the interface
needs some robustness work.