VortexMimeHeader * vortex_frame_get_mime_header ( VortexFrame frame,
const char *  mime_header 
)

Allows to get the content associated to a particular header.

Parameters
frameThe frame where the MIME header content will be retrieved.
mime_headerThe MIME header to get. See supported MIME headers.
Returns
A reference to the content of the MIME header or NULL if it fails or nothing is found. The function can only fail if some parameter provided is NULL.

Supported MIME headers:

The following are a set of macros that can be used to retrieve common MIME headers. You can still use direct string, but using them will disable compilation protection. For example:

1 // get content for MIME header "Content-Type"
2 VortexMimeHeader * header = vortex_frame_get_mime_header (frame, MIME_CONTENT_TYPE);
3 
4 // now get the content
5 const char * value = vortex_frame_mime_header_content (header);
6 
7 // for other MIME header that have allowed repeatable value values use next
8 header = vortex_frame_mime_header_next (header);
9 
10 // to simply get the first header do (returns first reference):
11 value = VORTEX_FRAME_GET_MIME_HEADER (frame, MIME_CONTENT_TYPE);

NOTE: There is an especial note about the "Content-Type" and "Content-Transfer-Encoding". If they aren't defined, it is assumed the following default values (RFC 3080, section 2.2):

  • "Content-Type" is "application/octet-stream"
  • "Content-Transfer-Encoding" is "binary"

In the case you don't want to receive NULL values and assume previous values, you must use vortex_frame_get_content_type and vortex_frame_get_transfer_encoding, which returns the appropiate values if they found the MIME status no holding such values.

Referenced by vortex_frame_get_content_type(), and vortex_frame_get_transfer_encoding().