module MrMime_contentEncoding:sig
..end
typemechanism =
[ `Base64
| `Binary
| `Bit7
| `Bit8
| `Ietf_token of string
| `QuotedPrintable
| `X_token of string ]
`Bit8
character or
`Binary
data. Such data cannot be transmitted over some transfer
protocols. For example, RFC821 (SMTP)
restricts mail messages to `Bit7
US-ASCII data whitch lines no longer than
1000 characters including any trailing CRLF
line separator.
Three transformations are currently defined: identity, the
"quoted-printable"
encoding, and the "base64"
encoding. The domains are
"binary"
, "8bit"
and "7bit"
.
The "Content-Transfer-Encoding"
values "7bit"
, "8bit"
, and "binary"
all mean that the identity (i.e. No) encoding transformation has been
performed. As such, they serve simply as indicators of the domain of the
body data, and provide useful information about the sort of encoding that
might be needed for transmission in a given transport system.
The "quoted-printable"
and "base64"
encodings transform their input from
an arbitrary domain into material in the "7bit"
range, thus making it safe
to carry over restricted transports. You can see MrMime.QuotedPrintable
for the "quoted-printable"
decoding and MrMime.Base64
for the
"base64"
decoding.
typefield =
[ `ContentEncoding of mechanism ]
mechanism
for encoding
such data into a `Bit7
short line format. Proper labelling of unencoded
material in less restrictive formats for direct use over less restrictive
transports is also desirable. This module specifies that such encodings will
be indicated by a new "Content-Transfer-Encoding"
header field.val pp : Format.formatter -> mechanism -> unit
pp mechanism
prints an human readable representation of mechanism
.val default : mechanism
`Bit7
requires that the body is already in a `Bit7
mail-ready representation. This is the default value -- that is,
"Content-Transfer-Encoding: 7BIT"
is assumed if the
"Content-Transfer-Encoding"
header field is not present.module Encoder:sig
..end
module Decoder:sig
..end
val of_string : ?chunk:int -> string -> mechanism option
of_string ~chunk:1024 buf
parses an
RFC2045 MrMime_contentEncoding.mechanism
starting at 0
in buf
.
This function allocates a internal buffer with chunk
size (default to
1024
).
val of_string_raw : ?chunk:int ->
string -> int -> int -> (mechanism * int) option
of_string_raw ~chunk:1024 buff off len
parses an
RFC2045 MrMime_contentEncoding.mechanism
starting at off
in buf
to a tuple (mechanism, count)
with:mechanism
the MrMime_contentEncoding.mechanism
count
the number of bytes read starting at off
to parse the
mechanism
.chunk
size (default to
1024
).