This is the drakma Reference Manual, version 2.0.10, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:04:15 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
drakma
Full-featured http/https client based on usocket
Dr. Edi Weitz
BSD
2.0.10
puri
(system).
cl-base64
(system).
chunga
(system).
flexi-streams
(system).
cl-ppcre
(system).
chipz
(system).
usocket
(system).
cl+ssl
(system).
packages.lisp
(file).
specials.lisp
(file).
conditions.lisp
(file).
util.lisp
(file).
read.lisp
(file).
cookies.lisp
(file).
encoding.lisp
(file).
request.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
drakma/drakma.asd
drakma/packages.lisp
drakma/specials.lisp
drakma/conditions.lisp
drakma/util.lisp
drakma/read.lisp
drakma/cookies.lisp
drakma/encoding.lisp
drakma/request.lisp
drakma/specials.lisp
packages.lisp
(file).
drakma
(system).
*allow-dotless-cookie-domains-p*
(special variable).
*body-format-function*
(special variable).
*default-http-proxy*
(special variable).
*drakma-default-external-format*
(special variable).
*drakma-version*
(special variable).
*header-stream*
(special variable).
*ignore-unparseable-cookie-dates-p*
(special variable).
*no-proxy-domains*
(special variable).
*remove-duplicate-cookies-p*
(special variable).
*text-content-types*
(special variable).
*hyperdoc-base-uri*
(special variable).
*time-zone-map*
(special variable).
+buffer-size+
(constant).
+known-methods+
(constant).
+latin-1+
(constant).
+redirect-codes+
(constant).
+redirect-to-get-codes+
(constant).
+redirect-to-get-methods+
(constant).
define-constant
(macro).
hyperdoc-lookup
(function).
drakma/conditions.lisp
specials.lisp
(file).
drakma
(system).
cookie-date-parse-error
(function).
cookie-date-parse-error
(condition).
cookie-error
(function).
cookie-error
(condition).
cookie-error-cookie
(reader method).
drakma-condition
(condition).
drakma-error
(condition).
drakma-warning
(condition).
parameter-error
(function).
parameter-error
(condition).
syntax-error
(function).
syntax-error
(condition).
drakma-simple-error
(condition).
drakma-simple-warning
(condition).
drakma-warn
(function).
drakma/util.lisp
conditions.lisp
(file).
drakma
(system).
header-value
(function).
parameter-present-p
(function).
parameter-value
(function).
url-encode
(function).
alist-to-url-encoded-string
(function).
default-port
(function).
dissect-query
(function).
ends-with-p
(function).
interpret-as-month
(function).
interpret-as-time-zone
(function).
make-random-string
(function).
make-ssl-stream
(function).
non-default-port
(function).
safe-parse-integer
(function).
set-referer
(function).
split-set-cookie-string
(function).
starts-with-p
(function).
text-content-type-p
(function).
user-agent-string
(function).
when-let
(macro).
with-sequence-from-string
(macro).
with-unique-names
(macro).
drakma/read.lisp
util.lisp
(file).
drakma
(system).
get-content-type
(function).
read-tokens-and-parameters
(function).
split-tokens
(function).
read-status-line
(function).
read-token-and-parameters
(function).
skip-more-commas
(function).
drakma/cookies.lisp
read.lisp
(file).
drakma
(system).
cookie
(class).
cookie-domain
(reader method).
(setf cookie-domain)
(writer method).
(setf cookie-domain)
(method).
cookie-expires
(reader method).
(setf cookie-expires)
(writer method).
(setf cookie-expires)
(method).
cookie-http-only-p
(reader method).
(setf cookie-http-only-p)
(writer method).
cookie-jar
(class).
cookie-jar-cookies
(reader method).
(setf cookie-jar-cookies)
(writer method).
cookie-name
(reader method).
(setf cookie-name)
(writer method).
(setf cookie-name)
(method).
cookie-path
(reader method).
(setf cookie-path)
(writer method).
(setf cookie-path)
(method).
cookie-securep
(reader method).
(setf cookie-securep)
(writer method).
cookie-value
(reader method).
(setf cookie-value)
(writer method).
(setf cookie-value)
(method).
cookie=
(function).
delete-old-cookies
(function).
initialize-instance
(method).
parse-cookie-date
(function).
print-object
(method).
print-object
(method).
check-cookie
(function).
cookie-domain-matches
(function).
get-cookies
(function).
normalize-cookie-domain
(function).
parse-set-cookie
(function).
render-cookie-date
(function).
send-cookie-p
(function).
update-cookies
(function).
valid-cookie-domain-p
(function).
drakma/encoding.lisp
cookies.lisp
(file).
drakma
(system).
decode-stream
(generic function).
decode-flexi-stream
(function).
decode-response-stream
(function).
drakma/request.lisp
encoding.lisp
(file).
drakma
(system).
http-request
(function).
%read-body
(function).
determine-body-format
(function).
make-form-data-function
(function).
read-body
(function).
send-content
(function).
trivial-uri-path
(function).
Packages are listed by definition order.
drakma
chunga
.
common-lisp
.
flexi-streams
.
*allow-dotless-cookie-domains-p*
(special variable).
*body-format-function*
(special variable).
*default-http-proxy*
(special variable).
*drakma-default-external-format*
(special variable).
*drakma-version*
(special variable).
*header-stream*
(special variable).
*ignore-unparseable-cookie-dates-p*
(special variable).
*no-proxy-domains*
(special variable).
*remove-duplicate-cookies-p*
(special variable).
*text-content-types*
(special variable).
cookie
(class).
cookie-date-parse-error
(function).
cookie-date-parse-error
(condition).
cookie-domain
(generic reader).
(setf cookie-domain)
(generic function).
cookie-error
(function).
cookie-error
(condition).
cookie-error-cookie
(generic reader).
cookie-expires
(generic reader).
(setf cookie-expires)
(generic function).
cookie-http-only-p
(generic reader).
(setf cookie-http-only-p)
(generic writer).
cookie-jar
(class).
cookie-jar-cookies
(generic reader).
(setf cookie-jar-cookies)
(generic writer).
cookie-name
(generic reader).
(setf cookie-name)
(generic function).
cookie-path
(generic reader).
(setf cookie-path)
(generic function).
cookie-securep
(generic reader).
(setf cookie-securep)
(generic writer).
cookie-value
(generic reader).
(setf cookie-value)
(generic function).
cookie=
(function).
decode-stream
(generic function).
delete-old-cookies
(function).
drakma-condition
(condition).
drakma-error
(condition).
drakma-warning
(condition).
get-content-type
(function).
header-value
(function).
http-request
(function).
parameter-error
(function).
parameter-error
(condition).
parameter-present-p
(function).
parameter-value
(function).
parse-cookie-date
(function).
read-tokens-and-parameters
(function).
split-tokens
(function).
syntax-error
(function).
syntax-error
(condition).
url-encode
(function).
%read-body
(function).
*hyperdoc-base-uri*
(special variable).
*time-zone-map*
(special variable).
+buffer-size+
(constant).
+known-methods+
(constant).
+latin-1+
(constant).
+redirect-codes+
(constant).
+redirect-to-get-codes+
(constant).
+redirect-to-get-methods+
(constant).
alist-to-url-encoded-string
(function).
check-cookie
(function).
cookie-domain-matches
(function).
decode-flexi-stream
(function).
decode-response-stream
(function).
default-port
(function).
define-constant
(macro).
determine-body-format
(function).
dissect-query
(function).
drakma-simple-error
(condition).
drakma-simple-warning
(condition).
drakma-warn
(function).
ends-with-p
(function).
get-cookies
(function).
hyperdoc-lookup
(function).
interpret-as-month
(function).
interpret-as-time-zone
(function).
make-form-data-function
(function).
make-random-string
(function).
make-ssl-stream
(function).
non-default-port
(function).
normalize-cookie-domain
(function).
parse-set-cookie
(function).
read-body
(function).
read-status-line
(function).
read-token-and-parameters
(function).
render-cookie-date
(function).
safe-parse-integer
(function).
send-content
(function).
send-cookie-p
(function).
set-referer
(function).
skip-more-commas
(function).
split-set-cookie-string
(function).
starts-with-p
(function).
text-content-type-p
(function).
trivial-uri-path
(function).
update-cookies
(function).
user-agent-string
(function).
valid-cookie-domain-p
(function).
when-let
(macro).
with-sequence-from-string
(macro).
with-unique-names
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
When this variable is not NIL, cookie domains containing no dots are considered valid. The default is NIL, meaning to disallow such domains except for "localhost".
A function which determines whether the content body returned by
the server is text and should be treated as such or not. The function
is called after the request headers have been read and it must accept
two arguments, headers and external-format-in, where headers is like
the third return value of HTTP-REQUEST while external-format-in is the
HTTP-REQUEST argument of the same name. It should return NIL if the
body should be regarded as binary content, or a FLEXI-STREAMS external
format (which will be used to read the body) otherwise.
This function will only be called if the force-binary argument to
HTTP-REQUEST is NIL.
The initial value of this variable is a function which uses *TEXT-CONTENT-TYPES* to determine whether the body is text and then proceeds as described in the HTTP-REQUEST documentation entry.
HTTP proxy to be used as default. If not NIL, it should be a string denoting a proxy server through which the request should be sent. Or it can be a list of two values - a string denoting the proxy server and an integer denoting the port to use (which will default to 80 otherwise).
The default value for the external format keyword arguments of HTTP-REQUEST. The value of this variable will be interpreted by FLEXI-STREAMS. The initial value is the keyword :LATIN-1. (Note that Drakma binds *DEFAULT-EOL-STYLE* to :LF).
Drakma’s version number as a string.
If this variable is not NIL, it should be bound to a stream to which incoming and outgoing headers will be written for debugging purposes.
Whether Drakma is allowed to treat ‘Expires’ dates in cookie headers as non-existent if it can’t parse them. If the value of this variable is NIL (which is the default), an error will be signalled instead.
A list of domains for which a proxy should not be used.
Determines how duplicate cookies in the response are handled,
defaults to T. Cookies are considered duplicate using COOKIE=. Valid
values are:
NIL - duplicates will not be removed,
T or :KEEP-LAST - for duplicates, only the last cookie value will be kept, based on the
order of the response header,
:KEEP-FIRST - for duplicates, only the first cookie value will be kept, based on the order of the response
header.
Misbehaving servers may send duplicate cookies back in the
same Set-Cookie header:
HTTP/1.1 200 OK
Server: My-hand-rolled-server
Date: Wed, 07 Apr 2010 15:12:30 GMT
Connection: Close
Content-Type: text/html
Content-Length: 82
Set-Cookie: a=1; Path=/; Secure, a=2; Path=/; Secure
In this case Drakma has to choose whether cookie ’a’ has the value ’1’
or ’2’. By default, Drakma will choose the last value specified, in
this case ’2’. By default, Drakma conforms to RFC2109 HTTP State
Management Mechanism, section 4.3.3 Cookie Management:
If a user agent receives a Set-Cookie response header whose NAME
is the same as a pre-existing cookie, and whose Domain and Path
attribute values exactly (string) match those of a pre-existing
cookie, the new cookie supersedes the old.
A list of conses which are used by the default value of
*BODY-FORMAT-FUNCTION* to decide whether a ’Content-Type’ header
denotes text content. The car and cdr of each cons should each be a
string or NIL. A content type matches one of these
entries (and thus denotes text) if the type part is STRING-EQUAL
to the car or if the car is NIL and if the subtype part
is STRING-EQUAL
to the cdr or if the cdr is NIL.
The initial value of this variable is the list
(("text" . nil))
which means that every content type that starts with "text/" is regarded as text, no matter what the subtype is.
Signals an error of type COOKIE-DATE-PARSE-ERROR with the provided format control and arguments.
Signals an error of type COOKIE-ERROR with the provided cookie (can be NIL), format control and arguments.
Returns true if the cookies COOKIE1 and COOKIE2 are equal. Two cookies are considered to be equal if name and path are equal.
Removes all cookies from COOKIE-JAR which have either expired or which don’t have an expiry date.
Reads and parses a ‘Content-Type’ header and returns it as three values - the type, the subtype, and an alist (possibly empty) of name/value pairs for the optional parameters. HEADERS is supposed to be an alist of headers as returned by HTTP-REQUEST. Returns NIL if there is no such header amongst HEADERS.
If HEADERS is an alist of headers as returned by HTTP-REQUEST and NAME is a keyword naming a header, this function returns the corresponding value of this header (or NIL if it’s not in HEADERS).
Sends a HTTP request to a web server and returns its reply. URI
is where the request is sent to, and it is either a string denoting a
uniform resource identifier or a PURI:URI object. The scheme of URI
must be ‘http’ or ‘https’. The function returns SEVEN values - the
body of the reply (but see below), the status code as an integer, an
alist of the headers sent by the server where for each element the car
(the name of the header) is a keyword and the cdr (the value of the
header) is a string, the URI the reply comes from (which might be
different from the URI the request was sent to in case of redirects),
the stream the reply was read from, a generalized boolean which
denotes whether the stream should be closed (and which you can
usually ignore), and finally the reason phrase from the status line as
a string.
PROTOCOL is the HTTP protocol which is going to be used in the
request line, it must be one of the keywords :HTTP/1.0 or
:HTTP/1.1. METHOD is the method used in the request line, a
keyword (like :GET or :HEAD) denoting a valid HTTP/1.1 or WebDAV
request method, or :REPORT, as described in the Versioning
Extensions to WebDAV. Additionally, you can also use the pseudo
method :OPTIONS* which is like :OPTIONS but means that an
"OPTIONS *" request line will be sent, i.e. the URI’s path and
query parts will be ignored.
If FORCE-SSL is true, SSL will be attached to the socket stream
which connects Drakma with the web server. Usually, you don’t
have to provide this argument, as SSL will be attached anyway if
the scheme of URI is ‘https’.
CERTIFICATE is the file name of the PEM encoded client certificate to
present to the server when making a SSL connection. KEY specifies the
file name of the PEM encoded private key matching the certificate.
CERTIFICATE-PASSWORD specifies the pass phrase to use to decrypt the
private key.
VERIFY can be specified to force verification of the certificate that
is presented by the server in an SSL connection. It can be specified
either as NIL if no check should be performed, :OPTIONAL to verify the
server’s certificate if it presented one or :REQUIRED to verify the
server’s certificate and fail if an invalid or no certificate was
presented.
MAX-DEPTH can be specified to change the maximum allowed certificate
signing depth that is accepted. The default is 10.
CA-FILE and CA-DIRECTORY can be specified to set the certificate
authority bundle file or directory to use for certificate validation.
The CERTIFICATE, KEY, CERTIFICATE-PASSWORD, VERIFY, MAX-DEPTH, CA-FILE
and CA-DIRECTORY parameters are ignored for non-SSL requests. They
are also ignored on LispWorks.
PARAMETERS is an alist of name/value pairs (the car and the cdr each
being a string) which denotes the parameters which are added to the
query part of the URL or (in the case of a POST request) comprise the
body of the request. (But see CONTENT below.) The values can also be
NIL in which case only the name (without an equal sign) is used in
the query string. The name/value pairs are URL-encoded using the
FLEXI-STREAMS external format EXTERNAL-FORMAT-OUT before they are sent
to the server unless FORM-DATA is true in which case the POST request
body is sent as ‘multipart/form-data’ using EXTERNAL-FORMAT-OUT. The
values of the PARAMETERS alist can also be pathnames, open binary
input streams, unary functions, or lists where the first element is of
one of the former types. These values denote files which should be
sent as part of the request body. If files are present in PARAMETERS,
the content type of the request is always ‘multipart/form-data’. If
the value is a list, the part of the list behind the first element is
treated as a plist which can be used to specify a content type and/or
a filename for the file, i.e. such a value could look like, e.g.,
(#p"/tmp/my_file.doc" :content-type "application/msword"
:filename "upload.doc").
URL-ENCODER specifies a custom URL encoder function which will be used
by drakma to URL-encode parameter names and values. It needs to be a
function of one argument. The argument is the string to encode, the
return value must be the URL-encoded string. This can be used if
specific encoding rules are required.
CONTENT, if not NIL, is used as the request body - PARAMETERS is
ignored in this case. CONTENT can be a string, a sequence of
octets, a pathname, an open binary input stream, or a function
designator. If CONTENT is a sequence, it will be directly sent
to the server (using EXTERNAL-FORMAT-OUT in the case of
strings). If CONTENT is a pathname, the binary contents of the
corresponding file will be sent to the server. If CONTENT is a
stream, everything that can be read from the stream until EOF
will be sent to the server. If CONTENT is a function designator,
the corresponding function will be called with one argument, the
stream to the server, to which it should send data.
Finally, CONTENT can also be the keyword :CONTINUATION in which case
HTTP-REQUEST returns only one value - a ‘continuation’ function. This
function has one required argument and one optional argument. The
first argument will be interpreted like CONTENT above (but it cannot
be a keyword), i.e. it will be sent to the server according to its
type. If the second argument is true, the continuation function can
be called again to send more content, if it is NIL the continuation
function returns what HTTP-REQUEST would have returned.
If CONTENT is a sequence, Drakma will use LENGTH to determine its
length and will use the result for the ‘Content-Length’ header sent to
the server. You can overwrite this with the CONTENT-LENGTH parameter
(a non-negative integer) which you can also use for the cases where
Drakma can’t or won’t determine the content length itself. You can
also explicitly provide a CONTENT-LENGTH argument of NIL which will
imply that no ‘Content-Length’ header will be sent in any case. If no
‘Content-Length’ header is sent, Drakma will use chunked encoding to
send the content body. Note that this will not work with older web
servers.
Providing a true CONTENT-LENGTH argument which is not a non-negative
integer means that Drakma /must/ build the request body in RAM and
compute the content length even if it would have otherwise used
chunked encoding, for example in the case of file uploads.
CONTENT-TYPE is the corresponding ‘Content-Type’ header to be sent and
will be ignored unless CONTENT is provided as well.
Note that a query already contained in URI will always be sent with
the request line anyway in addition to other parameters sent by
Drakma.
COOKIE-JAR is a cookie jar containing cookies which will
potentially be sent to the server (if the domain matches, if
they haven’t expired, etc.) - this cookie jar will be modified
according to the ‘Set-Cookie’ header(s) sent back by the server.
BASIC-AUTHORIZATION, if not NIL, should be a list of two strings
(username and password) which will be sent to the server for
basic authorization. USER-AGENT, if not NIL, denotes which
‘User-Agent’ header will be sent with the request. It can be one
of the keywords :DRAKMA, :FIREFOX, :EXPLORER, :OPERA, or :SAFARI
which denote the current version of Drakma or, in the latter four
cases, a fixed string corresponding to a more or less recent (as
of August 2006) version of the corresponding browser. Or it can
be a string which is used directly.
ACCEPT, if not NIL, specifies the contents of the ‘Accept’ header
sent.
RANGE optionally specifies a subrange of the resource to be requested.
It must be specified as a list of two integers which indicate the
start and (inclusive) end offset of the requested range, in bytes
(i.e. octets).
If PROXY is not NIL, it should be a string denoting a proxy
server through which the request should be sent. Or it can be a
list of two values - a string denoting the proxy server and an
integer denoting the port to use (which will default to 80
otherwise). Defaults to *default-http-proxy*.
PROXY-BASIC-AUTHORIZATION is used like
BASIC-AUTHORIZATION, but for the proxy, and only if PROXY is
true. If the host portion of the uri is present in the
*no-proxy-domains* or the NO-PROXY-DOMAINS list then the proxy
setting will be ignored for this request.
If NO-PROXY-DOMAINS is set then it will supersede the
*no-proxy-domains* variable. Inserting domains into this list will
allow them to ignore the proxy setting.
If REAL-HOST is not NIL, request is sent to the denoted host instead
of the URI host. When specified, REAL-HOST supersedes PROXY.
ADDITIONAL-HEADERS is a name/value alist of additional HTTP headers
which should be sent with the request. Unlike in PARAMETERS, the cdrs
can not only be strings but also designators for unary functions
(which should in turn return a string) in which case the function is
called each time the header is written.
If REDIRECT is not NIL, it must be a non-negative integer or T.
If REDIRECT is true, Drakma will follow redirects (return codes
301, 302, 303, or 307) unless REDIRECT is 0. If REDIRECT is an
integer, it will be decreased by 1 with each redirect.
Furthermore, if AUTO-REFERER is true when following redirects,
Drakma will populate the ‘Referer’ header with the URI that
triggered the redirection, overwriting an existing ‘Referer’
header (in ADDITIONAL-HEADERS) if necessary.
If KEEP-ALIVE is T, the server will be asked to keep the
connection alive, i.e. not to close it after the reply has been
sent. (Note that this not necessary if both the client and the
server use HTTP 1.1.) If CLOSE is T, the server is explicitly
asked to close the connection after the reply has been sent.
KEEP-ALIVE and CLOSE are obviously mutually exclusive.
If the message body sent by the server has a text content type, Drakma
will try to return it as a Lisp string. It’ll first check if the
‘Content-Type’ header denotes an encoding to be used, or otherwise it
will use the EXTERNAL-FORMAT-IN argument. The body is decoded using
FLEXI-STREAMS. If FLEXI-STREAMS doesn’t know the external format, the
body is returned as an array of octets. If the body is empty, Drakma
will return NIL.
If the message body doesn’t have a text content type or if
FORCE-BINARY is true, the body is always returned as an array of
octets.
If WANT-STREAM is true, the message body is NOT read and instead the
(open) socket stream is returned as the first return value. If the
sixth value of HTTP-REQUEST is true, the stream should be closed (and
not be re-used) after the body has been read. The stream returned is
a flexi stream (see http://weitz.de/flexi-streams/) with a chunked
stream (see http://weitz.de/chunga/) as its underlying stream. If
you want to read binary data from this stream, read from the
underlying stream which you can get with FLEXI-STREAM-STREAM.
Drakma will usually create a new socket connection for each HTTP
request. However, you can use the STREAM argument to provide an
open socket stream which should be re-used. STREAM MUST be a
stream returned by a previous invocation of HTTP-REQUEST where
the sixth return value wasn’t true. Obviously, it must also be
connected to the correct server and at the right position
(i.e. the message body, if any, must have been read). Drakma
will NEVER attach SSL to a stream provided as the STREAM
argument.
CONNECTION-TIMEOUT is the time (in seconds) Drakma will wait until it
considers an attempt to connect to a server as a failure. It is
supported only on some platforms (currently abcl, clisp, LispWorks,
mcl, openmcl and sbcl). READ-TIMEOUT and WRITE-TIMEOUT are the read
and write timeouts (in seconds) for the socket stream to the server.
All three timeout arguments can also be NIL (meaning no timeout), and
they don’t apply if an existing stream is re-used. READ-TIMEOUT
argument is only available for LispWorks, WRITE-TIMEOUT is only
available for LispWorks 5.0 or higher.
DEADLINE, a time in the future, specifies the time until which the
request should be finished. The deadline is specified in internal
time units. If the server fails to respond until that time, a
COMMUNICATION-DEADLINE-EXPIRED condition is signalled. DEADLINE is
only available on CCL 1.2 and later.
If PRESERVE-URI is not NIL, the given URI will not be processed. This
means that the URI will be sent as-is to the remote server and it is
the responsibility of the client to make sure that all parameters are
encoded properly. Note that if this parameter is given, and the
request is not a POST with a content-type of ‘multipart/form-data’,
PARAMETERS will not be used.
If DECODE-CONTENT is not NIL, then the content will automatically be
decoded according to any encodings specified in the Content-Encoding
header. The actual decoding is done by the DECODE-STREAM generic function,
and you can implement new methods to support additional encodings.
Any encodings in Transfer-Encoding, such as chunking, are always performed.
Signals an error of type PARAMETER-ERROR with the provided format control and arguments.
If PARAMETERS is an alist of parameters as returned by, for example, READ-TOKENS-AND-PARAMETERS and NAME is a string naming a parameter, this function returns the full parameter (name and value) - or NIL if it’s not in PARAMETERS.
If PARAMETERS is an alist of parameters as returned by, for example, READ-TOKENS-AND-PARAMETERS and NAME is a string naming a parameter, this function returns the value of this parameter - or NIL if it’s not in PARAMETERS.
Parses a cookie expiry date and returns it as a Lisp universal
time. Currently understands the following formats:
"Wed, 06-Feb-2008 21:01:38 GMT"
"Wed, 06-Feb-08 21:01:38 GMT"
"Tue Feb 13 08:00:00 2007 GMT"
"Wednesday, 07-February-2027 08:55:23 GMT"
"Wed, 07-02-2017 10:34:45 GMT"
Instead of "GMT" time zone abbreviations like "CEST" and UTC
offsets like "GMT-01:30" are also allowed.
While this function has "cookie" in its name, it might come in handy in other situations as well and it is thus exported as a convenience function.
Reads a comma-separated list of tokens from the string STRING. Each token can be followed by an optional, semicolon-separated list of attribute/value pairs where the attributes are tokens followed by a #\= character and a token or a quoted string. Returned is a list where each element is either a string (for a simple token) or a cons of a string (the token) and an alist (the attribute/value pairs). If VALUE-REQUIRED-P is NIL, the value part (including the #\= character) of each attribute/value pair is optional.
Splits the string STRING into a list of substrings separated by commas and optional whitespace. Empty substrings are ignored.
Signals an error of type SYNTAX-ERROR with the provided format control and arguments.
Returns a URL-encoded version of the string STRING using the external format EXTERNAL-FORMAT.
cookie-error
)) ¶cookie
)) ¶cookie
)) ¶Whether the cookie should not be
accessible from Javascript.
This is a Microsoft extension that has been implemented in Firefox as well. See <http://msdn2.microsoft.com/en-us/library/ms533046.aspx>.
cookie-jar
)) ¶cookie-jar
)) ¶A list of the cookies in this cookie jar.
Generic function to decode a stream.
This is a generic function which decodes the stream based on the encoding-type.
If a response contains one or more transfer or content encodings, then decode-stream
is called for each encoding type in the correct order to properly decode the stream to its
original content.
ENCODING-TYPE will be a keyword created by upcasing and interning the encoding type from the header. STREAM will be the stream that needs to be decoded. decode-stream returns a new stream from which you can read the decoded data.
(eql :chunked)
) stream) ¶General decode method for chunked stream. Creates new chunked-stream.
(eql :chunked)
) (stream chunked-input-stream
)) ¶Decode a chunked stream.
Special method for chunked-input-stream that just turns chunking on.
(eql :deflate)
) stream) ¶Decode stream using deflate compression in zlib container.
(eql :gzip)
) stream) ¶Decode stream using gzip compression.
Default handler, just return the stream.
cookie
) &rest initargs) ¶Check cookie validity after creation.
cookie
) stream) ¶Prints a representation of COOKIE similar to a ‘Set-Cookie’ header.
cookie-jar
) stream) ¶Print a cookie jar, showing the number of cookies it contains.
Signalled if Drakma tries to parse the date of an incoming cookie header and can’t interpret it.
Signalled if someone tries to create a COOKIE object that’s not valid.
The COOKIE object that caused this error.
Can be NIL in case such an object couldn’t be initialized.
(quote nil)
:cookie
This slot is read-only.
Superclass for all conditions related to Drakma.
condition
.
Superclass for all errors related to Drakma.
drakma-condition
.
error
.
Superclass for all warnings related to Drakma.
drakma-condition
.
warning
.
Signalled if a function was called with inconsistent or illegal parameters.
Signalled if Drakma encounters wrong or unknown syntax when reading the reply from the server.
Instances of this class represent HTTP cookies. If
you need to create your own cookies, you should use MAKE-INSTANCE with
the initargs :NAME, :DOMAIN, :VALUE, :PATH, :EXPIRES,
:SECUREP, and :HTTP-ONLY-P all of which are optional except for the
first two. The meaning of these initargs and the corresponding
accessors should be pretty clear if one looks at the original cookie
specification
<http://wp.netscape.com/newsref/std/cookie_spec.html> (and at this
page <http://msdn2.microsoft.com/en-us/library/ms533046.aspx> for the
HttpOnly extension).
(setf cookie-domain)
.
(setf cookie-domain)
.
cookie-domain
.
(setf cookie-expires)
.
(setf cookie-expires)
.
cookie-expires
.
(setf cookie-http-only-p)
.
cookie-http-only-p
.
(setf cookie-name)
.
(setf cookie-name)
.
cookie-name
.
(setf cookie-path)
.
(setf cookie-path)
.
cookie-path
.
(setf cookie-securep)
.
cookie-securep
.
(setf cookie-value)
.
(setf cookie-value)
.
cookie-value
.
initialize-instance
.
print-object
.
The name of the cookie.
(drakma:cookie-error nil "a cookie must have a name.")
:name
The cookie’s value.
""
:value
The domain the cookie is valid for.
(drakma:cookie-error nil "a cookie must have a domain.")
:domain
The path prefix the cookie is valid for.
"/"
:path
When the cookie expires. A Lisp universal time or NIL.
:expires
Whether the cookie must only be transmitted over secure connections.
:securep
Whether the cookie should not be
accessible from Javascript.
This is a Microsoft extension that has been implemented in Firefox as well. See <http://msdn2.microsoft.com/en-us/library/ms533046.aspx>.
:http-only-p
An object of this class encapsulates a
collection (a list, actually) of COOKIE objects. You create a new
cookie jar with (MAKE-INSTANCE ’COOKIE-JAR) where you can optionally
provide a list of COOKIE objects with the :COOKIES initarg. The
cookies in a cookie jar are accessed with COOKIE-JAR-COOKIES.
A list of the cookies in this cookie jar.
:cookies
The HTTP methods (including WebDAV methods) Drakma knows.
Default external format when reading headers.
A list of all HTTP return codes that redirect us to another URI.
A list of HTTP return codes that redirect using a GET method (see http://en.wikipedia.org/wiki/Post/Redirect/Get).
A list of HTTP methods that should be changed to GET in case of redirect (see http://en.wikipedia.org/wiki/Post/Redirect/Get).
An alist which maps time zone abbreviations to Common Lisp timezones.
A version of DEFCONSTANT for, cough, /strict/ CL implementations.
Evaluates EXPR, binds it to VAR, and executes BODY if VAR has a true value.
Kludge to make Chunga tokenizing functionality usable. Works like WITH-INPUT-FROM-STRING, but creates a sequence of octets that works with CHUNGA::PEEK-CHAR* and friends.
Syntax: WITH-UNIQUE-NAMES ( { var | (var x) }* ) declaration* form*
Executes a series of forms with each VAR bound to a fresh,
uninterned symbol. The uninterned symbol is as if returned by a call
to GENSYM with the string denoted by X - or, if X is not supplied, the
string denoted by VAR - as argument.
The variable bindings created are lexical unless special declarations
are specified. The scopes of the name bindings and declarations do not
include the Xs.
The forms are evaluated in order, and the values of all but the last are discarded (that is, the body is an implicit PROGN).
Helper function to read from stream into a buffer of element-type, which is returned.
ALIST is supposed to be an alist of name/value pairs where both names and values are strings (or, for values, NIL). This function returns a string where this list is represented as for the content type ‘application/x-www-form-urlencoded’, i.e. the values are URL-encoded using the external format EXTERNAL-FORMAT, the pairs are joined with a #\& character, and each name is separated from its value with a #\= character. If the value is NIL, no #\= is used.
Checks if the slots of the COOKIE object COOKIE have valid values and raises a corresponding error of type COOKIE-ERROR otherwise.
Checks if the domain DOMAIN (a string) matches the (PURI) URI URI.
Perform all necessary decodings on the internal stream of a flexi-stream.
Wrapper around decode-response-stream which preserverves the external format of the
flexi-stream.
If DECODE-CONTENT is nil, the Content-Encoding header will not be used to determine which decoding mechanisms to use. Most servers use Content-Encoding to identify compression.
Perform all necessary decodings on stream, from the Transfer-Encoding and
Content-Encoding headers.
If DECODE-CONTENT is nil, only the Transfer-Encoding headers will be used.
Returns the default port number for the (PURI) URI URI. Works only with the http and https schemes.
The default function used by Drakma to determine how the content body is to be read. See the docstring of *BODY-FORMAT-FUNCTION* for more info.
Accepts a query string as in PURI:URI-QUERY and returns a corresponding alist of name/value pairs.
Signals a warning of type DRAKMA-SIMPLE-WARNING with the provided format control and arguments.
Returns true if the sequence SEQ ends with the sequence SUFFIX. Individual elements are compared with TEST.
Returns a list of COOKIE objects corresponding to the ‘Set-Cookie’ header as found in HEADERS (an alist as returned by HTTP-REQUEST). Collects only cookies which match the domain of the (PURI) URI URI.
Tries to interpret STRING as a string denoting a month and returns the corresponding number of the month. Accepts three-letter abbreviations like "Feb" and full month names likes "February". Finally, the function also accepts strings representing integers from one to twelve.
Tries to interpret STRING as a time zone abbreviation which can either be something like "PST" or "GMT" with an offset like "GMT-02:00".
Creates and returns a closure which can be used as an argument for SEND-CONTENT to send PARAMETERS as a ‘multipart/form-data’ request body using the boundary BOUNDARY.
Generates and returns a random string length LENGTH. The string will consist solely of decimal digits and ASCII letters.
Attaches SSL to the stream HTTP-STREAM and returns the SSL stream (which will not be equal to HTTP-STREAM).
If the (PURI) URI specifies an explicit port number which is different from the default port its scheme, this port number is returned, otherwise NIL.
Adds a dot at the beginning of the string DOMAIN unless there is already one.
Parses the ‘Set-Cookie’ header line STRING and returns a list of three-element lists where each one contains the name of the cookie, the value of the cookie, and an attribute/value list for the optional cookie parameters.
Reads the message body from the HTTP stream STREAM using the information contained in HEADERS (as produced by HTTP-REQUEST). If TEXTP is true, the body is assumed to be of content type ‘text’ and will be returned as a string. Otherwise an array of octets (or NIL for an empty body) is returned. Returns the optional ‘trailer’ HTTP headers of the chunked stream (if any) as a second value.
Reads one line from STREAM (using Chunga’s READ-LINE*) and interprets it as a HTTP status line. Returns a list of two or three values - the protocol (HTTP version) as a keyword, the status code as an integer, and optionally the reason phrase.
Reads and returns (as a two-element list) from STREAM a token and an optional list of parameters (attribute/value pairs) following the token.
Returns a string representation of the universal time TIME which can be used for cookie headers.
Like PARSE-INTEGER, but returns NIL instead of signalling an error.
Sends CONTENT to the stream STREAM as part of the request body depending on the type of CONTENT.
Checks if the cookie COOKIE should be sent to the server depending on the (PURI) URI URI and the value of FORCE-SSL (as in HTTP-REQUEST).
Returns a fresh copy of the HTTP header list ALIST with the ‘Referer’ header set to REFERER-URI. If REFERER-URI is NIL, the result will be a list of headers without a ‘Referer’ header.
Reads and consumes from STREAM any number of commas and whitespace. Returns the following character or NIL in case of END-OF-FILE.
Splits the string STRING which is assumed to be the value of a
‘Set-Cookie’ into parts corresponding to individual cookies and
returns a list of these parts (substrings).
The string /should/ be split at commas, but heuristical approach is used instead which doesn’t split at commas which are followed by what cannot be recognized as the start of the next cookie. This is necessary because servers send headers containing unquoted commas which are not meant as separators.
Returns true if the sequence SEQ starts with the sequence PREFIX whereby the elements are compared using TEST.
Returns a true value iff the combination of TYPE and SUBTYPE matches an entry of *TEXT-CONTENT-TYPES*. See docstring of *TEXT-CONTENT-TYPES* for more info.
If the PRESERVE-URI argument is used, the URI needs to be passed to the server in unmodified form. This function returns just the path component of the URI with no URL encoding or other modifications done.
Updates the cookies in COOKIE-JAR by replacing those which are equal to a cookie in (the list) NEW-COOKIES with the corresponding ‘new’ cookie and adding those which are really new.
Returns a corresponding user agent string if TOKEN is one of the keywords :DRAKMA, :FIREFOX, :EXPLORER, :OPERA, or :SAFARI. Returns TOKEN itself otherwise.
Checks if the string DOMAIN contains enough dots to be acceptable. If *ALLOW-DOTLESS-COOKIE-DOMAINS-P* is non-NIL, every domain name is considered acceptable.
Like DRAKMA-ERROR but with formatting capabilities.
drakma-error
.
simple-condition
.
Like DRAKMA-WARNING but with formatting capabilities.
drakma-warning
.
simple-condition
.
Jump to: | %
(
A C D E F G H I M N P R S T U V W |
---|
Jump to: | %
(
A C D E F G H I M N P R S T U V W |
---|
Jump to: | *
+
C D E H N P S V |
---|
Jump to: | *
+
C D E H N P S V |
---|
Jump to: | C D E F P R S U |
---|
Jump to: | C D E F P R S U |
---|