| 2924 | } |
| 2925 | |
| 2926 | TSReturnCode |
| 2927 | TSHttpHdrReasonSet(TSMBuffer bufp, TSMLoc obj, const char *value, int length) |
| 2928 | { |
| 2929 | // Allow to modify the buffer only |
| 2930 | // if bufp is modifiable. If bufp is not modifiable return |
| 2931 | // TS_ERROR. If allowed, return TS_SUCCESS. Changed the |
| 2932 | // return value of function from void to TSReturnCode. |
| 2933 | sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); |
| 2934 | sdk_assert(sdk_sanity_check_http_hdr_handle(obj) == TS_SUCCESS); |
| 2935 | sdk_assert(sdk_sanity_check_null_ptr((void *)value) == TS_SUCCESS); |
| 2936 | |
| 2937 | if (!isWriteable(bufp)) { |
| 2938 | return TS_ERROR; |
| 2939 | } |
| 2940 | |
| 2941 | HTTPHdr h; |
| 2942 | |
| 2943 | SET_HTTP_HDR(h, bufp, obj); |
| 2944 | /* Don't need the assert as the check is done in sdk_sanity_check_http_hdr_handle |
| 2945 | ink_assert(h.m_http->m_type == HDR_HEAP_OBJ_HTTP_HEADER); |
| 2946 | */ |
| 2947 | |
| 2948 | if (length < 0) { |
| 2949 | length = strlen(value); |
| 2950 | } |
| 2951 | h.reason_set(value, length); |
| 2952 | return TS_SUCCESS; |
| 2953 | } |
| 2954 | |
| 2955 | const char * |
| 2956 | TSHttpHdrReasonLookup(TSHttpStatus status) |