TSMimeHdrFieldFind

Synopsis

#include <ts/ts.h>
TSMLoc TSMimeHdrFieldFind(TSMBuffer bufp, TSMLoc hdr, const char *name, int length)
const char *TSMimeHdrStringToWKS(const char *str, int length)

Description

Retrieves the TSMLoc location of a specified MIME field from within the MIME header located at hdr.

The name and length parameters specify which field to retrieve. For each MIME field in the MIME header, a case insensitive string comparison is done between the field name and name. If TSMimeHdrFieldFind() cannot find the requested field, it returns TS_NULL_MLOC. Release the returned TSMLoc handle with a call to TSHandleMLocRelease().

The name argument is best specified using the pre-defined Well-Known strings, such as e.g. TS_MIME_FIELD_CACHE_CONTROL and TS_MIME_LEN_CACHE_CONTROL. These WK constants can also be looked up using TSMimeHdrStringToWKS(). If a header does not have a WKS, this function will return a nullptr.