Home

Traffic Server Software Developers Kit

MIME Fields Always Belong to an Associated MIME Header

When using Traffic Server, you cannot create a new MIME field without an associated MIME header or HTTP header; MIME fields are always seen as part of a MIME header or HTTP header.

To use a MIME field, you must specify the MIME header or HTTP header to which it belongs - this is called the field’s parent header. The INKMimeField* functions in older versions of the SDK have been deprecated, as they do not require the parent header as inputs. The current version of Traffic Server uses new functions, the INKMimeHdrField* series, which require you to specify the location of the parent header along with the location of the MIME field. For every deprecated INKMimeField* function, there is a new, preferred INKMimeHdrField* function. Therefore, you should use the INKMimeHdrField* functions instead of the deprecated INKMimeField* series. Examples are provided below.

Instead of:

INKMLoc INKMimeFieldCreate (INKMBuffer bufp)

You should use:

INKMLoc INKMimeHdrFieldCreate (INKMBuffer bufp, INKMLoc   hdr)

Instead of:

void INKMimeFieldCopyValues (INKMBuffer dest_bufp, INKMLoc dest_offset,
   INKMBuffer src_bufp, INKMLoc src_offset)

You should use:

void INKMimeHdrFieldCopyValues (INKMBuffer dest_bufp, INKMLoc dest_hdr,
   INKMLoc dest_field, INKMBuffer src_bufp, INKMLoc src_hdr, INKMLoc
   src_field)

In the INKMimeHdrField* function prototypes, the INKMLoc field corresponds to the INKMLoc offset used the deprecated INKMimeField* functions (see the discussion of parent INKMLoc in the following section).