- if (length && SG(request_info).request_method && (!strstr(methods, SG(request_info).request_method))) {
- char *allow_header = emalloc(length + sizeof("Allow: "));
- sprintf(allow_header, "Allow: %s", methods);
- http_send_header(allow_header);
- efree(allow_header);
- http_send_status(405);
- zend_bailout();
+ char *found, *header;
+
+ if (!length || !SG(request_info).request_method) {
+ return;
+ }
+
+ 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;