A library to parse MIME headers and bodies into SXML.
cdr of the cell in
if not found. Useful for retrieving values associated with
Performs a fold operation on the MIME headers of source which can be
either a string or port, and defaults to current-input-port.
is called on the three values:
(kons header value accumulator)
where accumulator begins with
knil. Neither the header nor the
value are modified, except wrapped lines are handled for the value.
The optional procedure
kons-from is a procedure to be called when
the first line of the headers is an "From <address> <date>" line, to
enable this procedure to be used as-is on mbox files and the like.
It defaults to
kons, and if such a line is found the fold will begin
(kons-from '%from <address> (kons-from '%date <date> knil)).
limit gives a limit on the number of headers to read.
Return an alist of the MIME headers from source with headers all downcased.
str as a Content-Type style-value returning the list
(type (attr . val) ...).
(mime-parse-content-type "text/html; CHARSET=UTF-8; filename=index.html")
=> (text/html (charset . "UTF-8") (filename . "index.html"))
Replace all occurrences of RFC1522 =?ENC?...?= escapes in
the appropriate decoded and charset converted value.
Write out an alist of headers in mime format.
Performs a tree fold operation on the given string or port
src as a MIME body corresponding to the headers give in
headers are false or not provided they
are first read from
kons is called on the successive values:
(kons parent-headers part-headers part-body accumulator)
part-headers are the headers for the given MIME part (the
original headers for single-part MIME),
part-body is the
appropriately decoded and charset-converted body of the message,
accumulator begins with
If a multipart body is found, then a tree fold is performed,
down once to get a new accumulator to pass to
up on the result when returning. Their
(down headers seed)
(up headers parent-seed seed)
down simply returns null, and the default
up wraps the seed in the following sxml:
((mime (@ headers ...) seed ...) parent-seed ...)
Parse the given source as a MIME message and return
the result as an SXML object of the form:
(mime (@ (header . value) ...) parts ...).