(index ("rfc822-header->list" 0) ("rfc822-header-ref" 1132) ("rfc822-next-token" 1598) ("rfc822-field->tokens" 3368) ("rfc822-skip-cfws" 3712) ("*rfc822-atext-chars*" 3993) ("*rfc822-standard-tokenizers*" 4128) ("rfc822-atom" 4260) ("rfc822-dot-atom" 4323) ("rfc822-quoted-string" 4394) ("rfc822-parse-date" 4645) ("rfc822-date->seconds" 5104))
(def (sig (procedure "(rfc822-header->list iport &keyword strict? reader)" (id rfc822-header->list))) (p "Reads RFC822 format message from an input port iport, until it reaches the end of the message header. The header fields are unfolded, and broken into a list of the following format:") (p "((name body) ...)") (p "Name ... are the field names, and body ... are the corresponding field body, both as strings. Field names are converted to lower-case characters. Field bodies are not modified, except the folded line is concatenated, CRLFs removed. The order of fields are preserved.") (p "By default, the parser works permissively. If EOF is encountered during parsing header, it is taken as the end of the message. And if a line that doesn't consist neither continuing (folded) line nor start a new header field, it is simply ignored. You can change this behavior by giving true value to the keyword argument strict?; then the parser raises an error for such a malformed header.") (p "The keyword argument reader takes a procedure that reads a line from iport. Its default is read-line, which should be enough for most cases."))
(def (sig (procedure "(rfc822-header-ref header-list field-name &optional default)" (id rfc822-header-ref))) (p "An utility procedure to get a specific field from the parsed header list, which is returned by rfc822-header->list.") (p "Field-name specifies the field name in a lowercase string. If the field with given name is in header-list, the procedure returns its value in a string. Otherwise, if default is given, it is returned, and if not, #f is returned."))
(def (sig (procedure "(rfc822-next-token iport &optional tokenizer-specs)" (id rfc822-next-token))) (p "A basic tokenizer. First it skips whitespaces and/or comments (CFWS) from iport, if any. Then reads one token according to tokenizer-specs. If iport reaches EOF before any token is read, EOF is returned.") (p "Tokenizer-specs is a list of tokenizer spec, which is either a char-set or a cons of a char-set and a procedure.") (p "After skipping CFWS, the procedure peeks a character at the head of iport, and checks it against the char-sets in tokenizer-specs one by one. If a char-set that contains the character belongs to is found, then a token is retrieved as follows: If the tokenizer spec is just a char-set, a sequence of characters that belong to the char-set consists a token. If it is a cons, the procedure is called with iport to read a token.") (p "If the head character doesn't match any char-sets, the character is taken from iport and returned.") (p "The default tokenizer-specs is as follows:") (pre "(list (cons (char-set #\") rfc822-quoted-string)\n      (cons *rfc822-atext-chars* rfc822-dot-atom))") (p "Where rfc822-quoted-string and rfc822-dot-atom are tokenizer procedures described below, and *rfc822-atext-chars* is bound to a char-set of atext specified in rfc2822. This means rfc822-next-token retrieves a token either quoted-string or dot-atom specified in rfc2822 by default.") (p "Using tokenizer-specs, you can customize how the header field is parsed. For example, if you want to retrieve a token that is either (1) a word constructed by uppercase characters, or (2) a quoted string, then you can call rfc822-next-token by this:") (pre "(rfc822-next-token iport\n   `(,char-set:uppercase (,(char-set #\") . ,rfc822-quoted-string)))"))
(def (sig (procedure "(rfc822-field->tokens field &optional tokenizer-specs)" (id rfc822-field->tokens))) (p "A convenience procedure. Creates an input string port for a field body field, and calls rfc822-next-token repeatedly on it until it consumes all input, then returns a list of tokens. Tokenizer-specs is passed to rfc822-next-token."))
(def (sig (procedure "(rfc822-skip-cfws iport)" (id rfc822-skip-cfws))) (p "A utility procedure that consumes any comments and/or whitespace characters from iport, and returns the head character that is neither whitespace nor a comment. The returned character remains in iport."))
(def (sig (constant "*rfc822-atext-chars*" (id *rfc822-atext-chars*))) (p "Bound to a char-set that is a valid constituent of atom."))
(def (sig (constant "*rfc822-standard-tokenizers*" (id *rfc822-standard-tokenizers*))) (p "Bound to the default tokenizer-specs."))
(def (sig (procedure "(rfc822-atom iport)" (id rfc822-atom))))
(def (sig (procedure "(rfc822-dot-atom iport)" (id rfc822-dot-atom))))
(def (sig (procedure "(rfc822-quoted-string iport)" (id rfc822-quoted-string))) (p "Tokenizers for atom, dot-atom and quoted-string, respectively. The double-quotes and escaping backslashes within quoted-string are removed by rfc822-quoted-string."))
(def (sig (procedure "(rfc822-parse-date string)" (id rfc822-parse-date))) (p "Takes RFC-822 type date string, and returns eight values:") (p "year, month, day-of-month, hour, minutes, seconds, timezone, day-of-week.") (p "Timezone is an offset from UT in minutes. Day-of-week is a day from sunday, and may be #f if that information is not available. Month is an integer between 1 and 12, inclusive. If the string is not parsable, all the elements are #f."))
(def (sig (procedure "(rfc822-date->seconds string)" (id rfc822-date->seconds))) (p "Parses RFC822 type date format and returns the number of seconds since the first of January, 1970 UTC."))
