TSMimeHdrFieldValueStringSet

Synopsis

#include <ts/ts.h>

TSReturnCode TSMimeHdrFieldValueStringSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, const char *value, int length)

Description

TSMimeHdrFieldValueStringSet() sets the value of a MIME field. The field is identified by the combination of bufp, hdr, and field which should match those passed to the function that returned field such as TSMimeHdrFieldFind(). The value is copied to the header represented by bufp. value does not have to be null terminated (and in general should not be).

If idx is non-negative the existing value in the field is treated as a multi-value and idx as the 0 based index of which element to set. For example if the field had the value dave, grigor, tamara and TSMimeHdrFieldValueStringSet() was called with value of syeda and idx of 1, the value would be set to dave, syeda, tamara. If idx is non-negative it must be the index of an existing element or exactly one past the last element or the call will fail. In the example case idx must be between 0 and 3 inclusive. TSMimeHdrFieldValuesCount() can be used to get the current number of elements.

This function returns TS_SUCCESS if the value was set, TS_ERROR if not.