X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http.c;h=b26751a557a5fcac53ec4f05b884adfa465b92d8;hp=6a28a5e4fd89690e9befe4c17bdb1f3cfc211378;hb=c2b4f0332ead5425b183d2487ab5f25663f1009f;hpb=ae1297f5908f5683e7384395e5ae0e5a295be576 diff --git a/http.c b/http.c index 6a28a5e..b26751a 100644 --- a/http.c +++ b/http.c @@ -179,7 +179,7 @@ static inline void _http_globals_dtor(TSRMLS_D) efree(HTTP_G(ctype)); HTTP_G(ctype) = NULL; } - + #ifdef HTTP_HAVE_CURL # if LIBCURL_VERSION_NUM < 0x070c00 memset(&HTTP_G(curlerr), 0, sizeof(HTTP_G(curlerr))); @@ -193,21 +193,13 @@ static inline void _http_globals_dtor(TSRMLS_D) #define http_check_allowed_methods(m, l) _http_check_allowed_methods((m), (l) TSRMLS_CC) static inline void _http_check_allowed_methods(char *methods, int length TSRMLS_DC) { - char *found, *header; - - if (!length || !SG(request_info).request_method) { - return; + if (length && SG(request_info).request_method) { + if (SUCCESS != http_check_method_ex(SG(request_info).request_method, methods)) { + char *header = emalloc(length + sizeof("Allow: ")); + sprintf(header, "Allow: %s", methods); + http_exit(405, header); + } } - - if ( (found = strstr(methods, SG(request_info).request_method)) && - (found == SG(request_info).request_method || !isalpha(found[-1])) && - (!isalpha(found[strlen(SG(request_info).request_method) + 1]))) { - return; - } - - header = emalloc(length + sizeof("Allow: ")); - sprintf(header, "Allow: %s", methods); - http_exit(405, header); } /* }}} */