Next: (www server-utils form-2-form), Previous: (www server-utils big-dishing-loop), Up: The (www *) Modules [Contents][Index]
The (www server-utils parse-request) module provides procedures to
read the first line, the headers and the body, of an HTTP message on the
input port.
Keywords: s2s, style
Return a request object read from port.
Use s2s (defaults to string-titlecase) to normalize
the header names.
With #:s2s string-downcase, for instance, you would
see (host . "example.com") in the headers field
of the request object.
Keyword arg style is an object specifying the syntax of the initial (non-body) portion. By default, parse expects a normal HTTP 1.1 request message as per RFC 2616.
A request object has five fields.
methodA symbol, such as GET.
upathA string. You can use hqf<-upath
and alist<-query to break this down further.
protocol-versionA pair of integers indicating the protocol version.
For example, (1 . 1) corresponds to HTTP 1.1.
headersA list of pairs (name . value), aka alist,
where name is a symbol and value is a string.
How name is normalized depends on which s2s
was specified to receive-request.
bodyEither #f or a procedure get-body.
This should be called with one arg, flags,
to retrieve the request body.
See (www http), procedure receive-response,
for flags documentation.
Return #t if obj is a request object.
Return the respective field of request object req.
Parse string upath and return three values representing
its hierarchy, query and fragment components.
If a component is missing, its value is #f.
(hqf<-upath "/aa/bb/cc?def=xyz&hmm#frag") ⇒ "/aa/bb/cc" ⇒ "def=xyz&hmm" ⇒ "frag" (hqf<-upath "/aa/bb/cc#fr?ag") ⇒ "/aa/bb/cc" ⇒ #f ⇒ "fr?ag"
Parse urlencoded query-string and return an alist.
For each element (name . value) of the alist,
name is a string and value is either #f or a string.
If optional arg u8 is non-#f, use u8vector instead
of string for names and values. For example:
(alist<-query "ab&jk=yz" #t) ⇒ ((#u8(97 98) . #f) (#u8(106 107) . #u8(121 122)))
See (www url-coding).
Next: (www server-utils form-2-form), Previous: (www server-utils big-dishing-loop), Up: The (www *) Modules [Contents][Index]