MCPcopy Create free account
hub / github.com/apache/trafficserver / TSMimeHdrFieldValuesClear

Function TSMimeHdrFieldValuesClear

src/api/InkAPI.cc:2076–2101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2074}
2075
2076TSReturnCode
2077TSMimeHdrFieldValuesClear(TSMBuffer bufp, TSMLoc hdr, TSMLoc field)
2078{
2079 // Allow to modify the buffer only
2080 // if bufp is modifiable. If bufp is not modifiable return
2081 // TS_ERROR. If allowed, return TS_SUCCESS. Changed the
2082 // return value of function from void to TSReturnCode.
2083 sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS);
2084 sdk_assert((sdk_sanity_check_mime_hdr_handle(hdr) == TS_SUCCESS) || (sdk_sanity_check_http_hdr_handle(hdr) == TS_SUCCESS));
2085 sdk_assert(sdk_sanity_check_field_handle(field, hdr) == TS_SUCCESS);
2086
2087 if (!isWriteable(bufp)) {
2088 return TS_ERROR;
2089 }
2090
2091 MIMEFieldSDKHandle *handle = reinterpret_cast<MIMEFieldSDKHandle *>(field);
2092 HdrHeap *heap = (reinterpret_cast<HdrHeapSDKHandle *>(bufp))->m_heap;
2093
2094 /**
2095 * Modified the string value passed from an empty string ("") to null.
2096 * An empty string is also considered to be a token. The correct value of
2097 * the field after this function should be null.
2098 */
2099 mime_field_value_set(heap, handle->mh, handle->field_ptr, nullptr, 0, true);
2100 return TS_SUCCESS;
2101}
2102
2103int
2104TSMimeHdrFieldValuesCount(TSMBuffer bufp, TSMLoc hdr, TSMLoc field)

Callers 6

replace_headerFunction · 0.85
clearMethod · 0.85
HttpSetMimeHeaderFunction · 0.85

Calls 6

sdk_sanity_check_mbufferFunction · 0.85
isWriteableFunction · 0.85
mime_field_value_setFunction · 0.85

Tested by 1