Ocamlnet 3 Reference Manual : Netmime.mime_header_ro

# Class type Netmime.mime_header_ro

    class type mime_header_ro = object .. end

This is the read-only version of a MIME header. There are only methods to read the header fields.

    method fields : (string * string) list

    method field : string -> string

    method multiple_field : string -> string list

The current fields of the header. `fields` returns the complete header. `field name` returns the value of the field, or raises `Not_found`. `multiple_field name` returns all fields with the same name.

Note that field names are case-insensitive; `field "content-length"`, and `field "CONTENT-LENGTH"` will return the same field. However, the method `fields` returns the original field names, without adjustment of the case.

The order of the fields is preserved.

## Access methods for frequent standard fields.

These methods will raise `Not_found` if the fields are not present.

    method content_length : unit -> int

Returns the Content-length field as integer

    method content_type : unit -> string * (string * Mimestring.s_param) list

Returns the Content-type as parsed value. The left value of the pair is the main type, and the right value is the list of parameters. For example, for the field value `"text/plain; charset=utf-8"` this method returns `("text/plain", ["charset", p])` where `p` is an opaque value with `Mimestring.param_value p = "utf-8"`.

    method content_disposition : unit -> string * (string * Mimestring.s_param) list

Returns the Content-disposition field as parsed value. The left value is the main disposition, and the right value is the list of parameters. For example, for the field value `"attachment; filename=xy.dat"` this method returns `("attachment", ["filename", p])` where `p` is an opaque value with `Mimestring.param_value p = "xy.dat"`.

    method content_transfer_encoding : unit -> string

Returns the Content-transfer-encoding as string