| 2308 | } |
| 2309 | |
| 2310 | TSReturnCode |
| 2311 | TSMimeHdrFieldValueUintSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, unsigned int value) |
| 2312 | { |
| 2313 | // Allow to modify the buffer only |
| 2314 | // if bufp is modifiable. If bufp is not modifiable return |
| 2315 | // TS_ERROR. If allowed, return TS_SUCCESS. Changed the |
| 2316 | // return value of function from void to TSReturnCode. |
| 2317 | sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); |
| 2318 | sdk_assert((sdk_sanity_check_mime_hdr_handle(hdr) == TS_SUCCESS) || (sdk_sanity_check_http_hdr_handle(hdr) == TS_SUCCESS)); |
| 2319 | sdk_assert(sdk_sanity_check_field_handle(field, hdr) == TS_SUCCESS); |
| 2320 | |
| 2321 | if (!isWriteable(bufp)) { |
| 2322 | return TS_ERROR; |
| 2323 | } |
| 2324 | |
| 2325 | char tmp[16]; |
| 2326 | int len = mime_format_uint(tmp, value, sizeof(tmp)); |
| 2327 | |
| 2328 | TSMimeFieldValueSet(bufp, field, idx, tmp, len); |
| 2329 | return TS_SUCCESS; |
| 2330 | } |
| 2331 | |
| 2332 | TSReturnCode |
| 2333 | TSMimeHdrFieldValueAppend(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, const char *value, int length) |