Build the Allow field-value from the request handler method mask. */
| 1040 | /* Build the Allow field-value from the request handler method mask. |
| 1041 | */ |
| 1042 | static char *make_allow(request_rec *r) |
| 1043 | { |
| 1044 | apr_int64_t mask; |
| 1045 | apr_array_header_t *allow = apr_array_make(r->pool, 10, sizeof(char *)); |
| 1046 | apr_hash_index_t *hi = apr_hash_first(r->pool, methods_registry); |
| 1047 | /* For TRACE below */ |
| 1048 | core_server_config *conf = |
| 1049 | ap_get_core_module_config(r->server->module_config); |
| 1050 | |
| 1051 | mask = r->allowed_methods->method_mask; |
| 1052 | |
| 1053 | for (; hi; hi = apr_hash_next(hi)) { |
| 1054 | const void *key; |
| 1055 | void *val; |
| 1056 | |
| 1057 | apr_hash_this(hi, &key, NULL, &val); |
| 1058 | if ((mask & (AP_METHOD_BIT << *(int *)val)) != 0) { |
| 1059 | APR_ARRAY_PUSH(allow, const char *) = key; |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | /* TRACE is tested on a per-server basis */ |
| 1064 | if (conf->trace_enable != AP_TRACE_DISABLE) |
| 1065 | *(const char **)apr_array_push(allow) = "TRACE"; |
| 1066 | |
| 1067 | /* ### this is rather annoying. we should enforce registration of |
| 1068 | ### these methods */ |
| 1069 | if ((mask & (AP_METHOD_BIT << M_INVALID)) |
| 1070 | && (r->allowed_methods->method_list != NULL) |
| 1071 | && (r->allowed_methods->method_list->nelts != 0)) { |
| 1072 | apr_array_cat(allow, r->allowed_methods->method_list); |
| 1073 | } |
| 1074 | |
| 1075 | return apr_array_pstrcat(r->pool, allow, ','); |
| 1076 | } |
| 1077 | |
| 1078 | AP_DECLARE(int) ap_send_http_options(request_rec *r) |
| 1079 | { |
no test coverage detected