From 7787d4fcc33ce6b85aff28103516fc102b6e41d9 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 11 Feb 2005 17:43:12 +0000 Subject: [PATCH] * we must send an allow header --- http.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index f189a1a..0cf01ae 100644 --- a/http.c +++ b/http.c @@ -1073,6 +1073,10 @@ static void php_http_init_globals(zend_http_globals *http_globals) PHP_INI_MH(update_allowed_methods) { if (SG(request_info).request_method && new_value_length && (!strstr(new_value, SG(request_info).request_method))) { + char *allow_header = emalloc(new_value_length + sizeof("Allow: ")); + sprintf(allow_header, "Allow: %s", new_value); + http_send_header(allow_header); + efree(allow_header); http_send_status(405); return SUCCESS; } @@ -1110,7 +1114,12 @@ PHP_MSHUTDOWN_FUNCTION(http) PHP_RINIT_FUNCTION(http) { char *allowed_methods = INI_STR("http.allowed_methods"); - if (SG(request_info).request_method && strlen(allowed_methods) && (!strstr(allowed_methods, SG(request_info).request_method))) { + int am_len; + if (SG(request_info).request_method && (am_len = strlen(allowed_methods)) && (!strstr(allowed_methods, SG(request_info).request_method))) { + char *allow_header = emalloc(am_len + sizeof("Allow: ")); + sprintf(allow_header, "Allow: %s", allowed_methods); + http_send_header(allow_header); + efree(allow_header); http_send_status(405); } return SUCCESS; @@ -1156,7 +1165,7 @@ PHP_MINFO_FUNCTION(http) #endif ); php_info_print_table_end(); - + DISPLAY_INI_ENTRIES(); } /* }}} */ -- 2.30.2