| 2074 | } |
| 2075 | |
| 2076 | TSReturnCode |
| 2077 | TSMimeHdrFieldValuesClear(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 | |
| 2103 | int |
| 2104 | TSMimeHdrFieldValuesCount(TSMBuffer bufp, TSMLoc hdr, TSMLoc field) |