| 2264 | } |
| 2265 | |
| 2266 | TSReturnCode |
| 2267 | TSMimeHdrFieldValueIntSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int value) |
| 2268 | { |
| 2269 | // Allow to modify the buffer only |
| 2270 | // if bufp is modifiable. If bufp is not modifiable return |
| 2271 | // TS_ERROR. If allowed, return TS_SUCCESS. Changed the |
| 2272 | // return value of function from void to TSReturnCode. |
| 2273 | sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); |
| 2274 | sdk_assert((sdk_sanity_check_mime_hdr_handle(hdr) == TS_SUCCESS) || (sdk_sanity_check_http_hdr_handle(hdr) == TS_SUCCESS)); |
| 2275 | sdk_assert(sdk_sanity_check_field_handle(field, hdr) == TS_SUCCESS); |
| 2276 | |
| 2277 | if (!isWriteable(bufp)) { |
| 2278 | return TS_ERROR; |
| 2279 | } |
| 2280 | |
| 2281 | char tmp[16]; |
| 2282 | int len = mime_format_int(tmp, value, sizeof(tmp)); |
| 2283 | |
| 2284 | TSMimeFieldValueSet(bufp, field, idx, tmp, len); |
| 2285 | return TS_SUCCESS; |
| 2286 | } |
| 2287 | |
| 2288 | TSReturnCode |
| 2289 | TSMimeHdrFieldValueInt64Set(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int64_t value) |