| 2379 | } |
| 2380 | |
| 2381 | TSReturnCode |
| 2382 | TSMimeHdrFieldValueIntInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int value) |
| 2383 | { |
| 2384 | // Allow to modify the buffer only |
| 2385 | // if bufp is modifiable. If bufp is not modifiable return |
| 2386 | // TS_ERROR, else return TS_SUCCESS. |
| 2387 | sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); |
| 2388 | sdk_assert((sdk_sanity_check_mime_hdr_handle(hdr) == TS_SUCCESS) || (sdk_sanity_check_http_hdr_handle(hdr) == TS_SUCCESS)); |
| 2389 | sdk_assert(sdk_sanity_check_field_handle(field, hdr) == TS_SUCCESS); |
| 2390 | |
| 2391 | if (!isWriteable(bufp)) { |
| 2392 | return TS_ERROR; |
| 2393 | } |
| 2394 | |
| 2395 | char tmp[16]; |
| 2396 | int len = mime_format_int(tmp, value, sizeof(tmp)); |
| 2397 | |
| 2398 | TSMimeFieldValueInsert(bufp, field, tmp, len, idx); |
| 2399 | return TS_SUCCESS; |
| 2400 | } |
| 2401 | |
| 2402 | TSReturnCode |
| 2403 | TSMimeHdrFieldValueUintInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, unsigned int value) |