| 2795 | } |
| 2796 | |
| 2797 | TSReturnCode |
| 2798 | TSHttpHdrMethodSet(TSMBuffer bufp, TSMLoc obj, const char *value, int length) |
| 2799 | { |
| 2800 | // Allow to modify the buffer only |
| 2801 | // if bufp is modifiable. If bufp is not modifiable return |
| 2802 | // TS_ERROR. If allowed, return TS_SUCCESS. Changed the |
| 2803 | // return value of function from void to TSReturnCode. |
| 2804 | sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS); |
| 2805 | sdk_assert(sdk_sanity_check_http_hdr_handle(obj) == TS_SUCCESS); |
| 2806 | sdk_assert(sdk_sanity_check_null_ptr((void *)value) == TS_SUCCESS); |
| 2807 | |
| 2808 | if (!isWriteable(bufp)) { |
| 2809 | return TS_ERROR; |
| 2810 | } |
| 2811 | |
| 2812 | HTTPHdr h; |
| 2813 | |
| 2814 | SET_HTTP_HDR(h, bufp, obj); |
| 2815 | if (length < 0) { |
| 2816 | length = strlen(value); |
| 2817 | } |
| 2818 | |
| 2819 | h.method_set(value, length); |
| 2820 | return TS_SUCCESS; |
| 2821 | } |
| 2822 | |
| 2823 | const char * |
| 2824 | TSHttpHdrHostGet(TSMBuffer bufp, TSMLoc obj, int *length) |