Wilbur: HTTP Client
-
URL API
-
HTTP Stream API
-
Date Input and Output
1. URL API
The URL object API exists for the benefit of the HTTP client code; other
parts of the toolkit (the XML and RDF parsers) represent URLs as strings.
make-url (string) [Function]
Parses the URL in string (a string) and returns an url
instance (the class url is abstract,
an instance of some subclass is returned). The function will signal malformed-url
if the parsing fails.
url [Class]
Abstract base class of URLs.
url-string (url) [Generic
function]
Returns a string rendition of the URL.
url-path (url) [Generic
function]
Returns the path component of the URL (as a string).
file-url [Class]
Concrete class (subclass of url) of file-URLs
(these URLs only have a path component). Do not instantiate this class
directly, instead use make-url.
http-url [Class]
Concrete class (subclass of url) of http-URLs
(these URLs have a host and a port component in addition to the path component).
Do not instantiate this class directly, instead use make-url.
url-host (http-url) [Generic
function]
Returns the host component of an http-url
instance (as a string).
url-port (http-url) [Generic
function]
Returns the port component of an http-url
instance (as an integer).
2. HTTP Stream API
In the current version of Wilbur the HTTP streams functionality is only avaible
on the Macintosh Common Lisp (due to the fact that
open-http-stream uses an MCL-specific implementation of the socket interface).
open-http-stream (url
proxy) [Generic function]
Opens and returns a bidirectional stream for requesting the URL url
(an instance of some subclass of url),
possibly via the HTTP proxy proxy (an http-url
instance).
open-http-stream ((url http-url)
(proxy null)) [Method]
An implementation of open-http-stream
for regular HTTP URLs without an HTTP proxy.
open-http-stream ((url
http-url) (proxy http-url)) [Method]
An implementation of open-http-stream
for regular HTTP URLs with requests going through an HTTP proxy. Proxies
are specified as HTTP URLs, the system will merely ignore any path component.
http-message [Class]
This class represents HTTP response messages.
http-status (http-message)
[Generic function]
Returns the status code of the HTTP response (as an integer).
http-version (http-message)
[Generic function]
Returns the version string of the HTTP response.
http-headers (http-message)
[Generic function]
Returns an a-list (in the string
dictionary format) of HTTP response headers.
http-body (http-message)
[Generic function]
Returns an open input stream which, when read, will yield the body of the
HTTP response to "GET".
get-header (http-message header)
[Generic function]
Returns the HTTP header named by the string header from the HTTP
response http-message (an http-message
instance), or nil if no header with that name is found.
http-head (url &key
proxy)
[Generic function]
Performs an HTTP "HEAD" request to the URL url (possibly via the
HTTP proxy proxy), and returns an HTTP response (an instance of
http-message).
The response has a null body, i.e. the function http-body
will return nil.
http-get (url &optional
proxy)
[Generic function]
Performs an HTTP "GET" request to the URL url (possibly via the
HTTP proxy proxy), and returns an HTTP response (an instance of
http-message).
The body of the response can be read from an input stream which can be
accessed via the function http-body.
with-http-response ((response
body-input-stream url &optional proxy) &body body)
[Macro]
Performs an HTTP "GET" request to the URL url (possibly via the
HTTP proxy proxy), and for the execution of the forms in body
binds the variable response to the HTTP response object (an instance
of http-message) and the variable
body-input-stream
to an input stream which will yield the response body (see the function
http-body
for an explanation). Regardless of how the execution of body ends,
the input stream is closed on exit.
3. Date Input and Output
parse-http-date (string)
[Function]
This function parses the string string according to the date syntax(es)
specified in RFC 2616 (HTTP/1.1):
-
RFC 1123
-
RFC 850 (with the assumption of 21st century)
-
ASC Time
The parser is non-dogmatic about the formats, and merely returns
nil
if it detects something in such violation of the standards that it would
make reliable parsing impossible. Successfully parsed time is returned
in the Common Lisp universal-time format.
parse-iso8601-date (string)
[Function]
This function parses the string string assuming it contains an ISO
8601 -formatted date. Successfully parsed time is returned in Common Lisp
universal-time format; otherwise nil is returned.
iso8601-date-string (universal-time)
[Function]
This function takes an integer universal-time (assumed to contain
a date in universal-time format) and returns a string with the date formatted
according to the ISO 8601 standard. The current time zone is assumed.
Copyright © 2001 Nokia. All Rights Reserved.
Subject to the NOKOS License version 1.0
Author: Ora Lassila (ora.lassila@nokia.com)