Request/Response Layer

Version 0.3.0

0.0.0  Initial version (part of agent interface).
0.1.0  Split off into its own spec.
0.1.1  Added note that CGI programs can handle both GET and POST.
0.1.2  Specify Content-Type of request and response.
0.2.0  Replace "Inf" with "Infinity" (conform to IEEE).
0.2.1  Clarification of end-of-line.
0.3.0  Values are space-separated words.

A client submits a request to a server, which returns a response.  Both
the request and response consist of a list of name/value pairs.  A
name is always an ASCII string containing only letters, digits, and
underscores, and beginning with a letter.  A value is always a string
of ASCII characters in the range [32,126], and is interpreted as a
sequence of space-separated words (so leading and trailing spaces are
not significant, nor are extra inter-word spaces).  A name may appear
more than once in a request or response.

Names beginning with capital letters must be understood; if you
encounter such a name in a request or response and don't understand it,
then you don't understand the request or response.  Names that do not
begin with capital letters convey extra information that may be safely
ignored if not understood.

The only transport mechanism for request/response defined at this
time is HTTP.  In the request, the name/value pairs are handled
exactly as for HTML forms:  Spaces are replaced by plus signs, special
characters are URL-encoded, and the pairs are concatenated, separated by
ampersands, to produce the query string, like so:


Then, if the GET method is being used, a question mark and the query
string are appended to the URI.  If the POST method is being used, the
query string is used as the body of the POST operation to the unadorned
URI, with a Content-Type of application/x-www-form-urlencoded.

According to the HTTP spec, the GET method may be used only for
operations that have no side effects, or at least no side effects for
which the requestor is accountable.  However, it is easy to write CGI
programs that work identically with either method; they can always
gather name/value pairs from both the query string and the body.  Then
you can specify the correct method, but the user can still choose the
other method if it's more convenient.

The response comes back as the body of the result, with any
Content-Type.  Inside the body, each line may be terminated with CRLF or
just LF, so the recipient must deal with both styles.  The first line


and nothing else marks the beginning of the name/value pairs.  Each line
after that is of the form name=value, until a line containing only


Arbitrary text may preceed the BEGIN line and follow the END line.

Unless otherwise specified at a higher layer, integers are represented
as strings in the style of %d (see scanf(3S)), and floats are
represented as strings in the style of %f, or one of the strings
"Infinity", "+Infinity", "-Infinity".

[AMC]  Prepared by Adam M. Costello
 Last modified: 1997-Dec-11-Thu 23:06:30 GMT
[Any Browser]