Next: form-2-form, Previous: big-dishing-loop, Up: Top
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.
Parse the first line of the HTTP message from input port and return a list of the method, URL path and HTTP version indicator, or
#f
if the line ends prematurely or is otherwise malformed. A successful parse consumes the trailing ‘CRLF’ of the line as well. The method is a symbol with its constituent characters upcased, such asGET
; the other elements are strings. If the first line is missing the HTTP version,parse-first-line
returns the default "HTTP/1.0".
Parse 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") ⇒ #<values "/aa/bb/cc" "def=xyz&hmm" "frag"> (hqf<-upath "/aa/bb/cc#fr?ag") ⇒ #<values "/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.
Parse the headers of the HTTP message from input port and return a list of key/value pairs, or
#f
if the message ends prematurely or is otherwise malformed. Both keys and values are strings. Values are trimmed of leading and trailing whitespace and may be empty. Values that span more than one line have their "continuation whitespace" reduced to a single space. A successful parse consumes the trailing ‘CRLF’ of the header block as well.
Sometimes you are interested in the body of the message but not the headers.
In this case, you can use skip-headers
to quickly position the port.