| Extracted from Pike v7.8 release 700 at 2013-06-08.

[Top]
MIME

# Method MIME.parse_headers()

Method parse_headers

  `array(mapping(string:string)|string) parse_headers(string message)`
  `array(mapping(string:array(string))|string) parse_headers(string message, int(1..1) use_multiple)`

Description

  This is a low level function that will separate the headers from the body of an encoded message. It will also translate the headers into a mapping. It will however not try to analyze the meaning of any particular header. This means that the body is returned as is, with any transfer-encoding intact.

  It is possible to call this function with just the header part of a message, in which case an empty body will be returned.

  The result is returned in the form of an array containing two elements. The first element is a mapping containing the headers found. The second element is a string containing the body.

  Headers that occurr multiple times will have their contents NUL separated, unless use_multiple has been specified, in which case the contents will be arrays.