78 lines
2.3 KiB
TeX
78 lines
2.3 KiB
TeX
\chapter{Parsing and Processing URLs}\label{cha:url}
|
|
%
|
|
The \ex{url} module contains procedures to parse and unparse HTTP 1.1 Request-URIs.
|
|
|
|
\defun{url-string->http-url}{string}{http-url}
|
|
\begin{desc}
|
|
\ex{Url-string->http-url} parses the Request-URI \var{string} into a
|
|
\ex{http-url} record.
|
|
\end{desc}
|
|
|
|
\defun{http-url?}{thing}{boolean}
|
|
\begin{desc}
|
|
\ex{http-url?} is the predicate for the \ex{http-url} record.
|
|
\end{desc}
|
|
|
|
\defun{http-url-host}{http-url}{string or \sharpf}
|
|
\defunx{http-url-port}{http-url}{integer or \sharpf}
|
|
\defunx{http-url-path}{http-url}{list}
|
|
\defunx{http-url-query}{http-url}{string or \sharpf}
|
|
|
|
\begin{desc}
|
|
\ex{http-url-host}, \ex{http-url-port}, \ex{http-url-path} and
|
|
\ex{http-url-query} are the selectors for the \ex{http-url} record.
|
|
|
|
The \var{host} slot is a non-empty string or \sharpf.
|
|
|
|
The \var{port} slot is an integer or \sharpf.
|
|
|
|
The \var{path} slot is a list of strings containing the
|
|
Request-URI's path split at slashes and \emph{unescaped}.If the
|
|
Request-URI's path ends with a slash, an empty string is inserted as
|
|
the last element of the list.
|
|
|
|
The \var{query} slot is an non-empty-string, still in its
|
|
\emph{escaped} representation, or \sharpf.
|
|
\end{desc}
|
|
%
|
|
Examples for Request-URI strings and the slots of the corresponding
|
|
http-url record: \nopagebreak
|
|
\begin{alltt}
|
|
"http://foo.bar.org:7777///foo%20foo//bar.htm?bulb%20bulb"
|
|
\(\Rightarrow\) "foo.bar.org" 7777 '("foo foo" "bar.htm") "bulb%20bulb"
|
|
|
|
"http://foo.bar.org"
|
|
\(\Rightarrow\) "foo.bar.org" #f '() #f
|
|
|
|
"http://foo.bar.org//"
|
|
\(\Rightarrow\) "foo.bar.org" #f '("") #f
|
|
|
|
"/foo%20foo//bar.htm?bulb%20bulb"
|
|
\(\Rightarrow\) #f #f '("foo foo" "bar.htm") "bulb%20bulb"
|
|
|
|
"/foo%20foo//?bulb%20bulb"
|
|
\(\Rightarrow\) #f #f '("foo foo" "") "bulb%20bulb"
|
|
|
|
"/"
|
|
\(\Rightarrow\) #f #f '("") #f
|
|
\end{alltt}
|
|
|
|
|
|
\defun{http-url->url-string}{http-url}{string}
|
|
\begin{desc}
|
|
\ex{http-url->url-string} unparses a \ex{http-url} record and returns the
|
|
Request-URI \ex{string} of the original HTTP Request.
|
|
\end{desc}
|
|
|
|
\defun{http-url-path->path-string}{http-url-path}{string}
|
|
\begin{desc}
|
|
\ex{http-url-path->url-string} unparses the \ex{http-url-path} field of
|
|
an http-url record into its corresponding part of the Request-URI
|
|
\ex{string} of the original HTTP Request (re-escaping the path).
|
|
\end{desc}
|
|
|
|
%%% Local Variables:
|
|
%%% mode: latex
|
|
%%% TeX-master: "man"
|
|
%%% End:
|