| 2357 | } |
| 2358 | |
| 2359 | TSReturnCode |
| 2360 | TSMimeHdrFieldValueStringInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, const char *value, int length) |
| 2361 | { |
| 2362 | // Allow to modify the buffer only |
| 2363 | // if bufp is modifiable. If bufp is not modifiable return |
| 2364 | // TS_ERROR, else return TS_SUCCESS. |
| 2365 | sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); |
| 2366 | sdk_assert((sdk_sanity_check_mime_hdr_handle(hdr) == TS_SUCCESS) || (sdk_sanity_check_http_hdr_handle(hdr) == TS_SUCCESS)); |
| 2367 | sdk_assert(sdk_sanity_check_field_handle(field, hdr) == TS_SUCCESS); |
| 2368 | sdk_assert(sdk_sanity_check_null_ptr((void *)value) == TS_SUCCESS); |
| 2369 | |
| 2370 | if (!isWriteable(bufp)) { |
| 2371 | return TS_ERROR; |
| 2372 | } |
| 2373 | |
| 2374 | if (length == -1) { |
| 2375 | length = strlen(value); |
| 2376 | } |
| 2377 | TSMimeFieldValueInsert(bufp, field, value, length, idx); |
| 2378 | return TS_SUCCESS; |
| 2379 | } |
| 2380 | |
| 2381 | TSReturnCode |
| 2382 | TSMimeHdrFieldValueIntInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int value) |