summaryrefslogtreecommitdiff
path: root/sapi/cli/php_http_parser.c
diff options
context:
space:
mode:
authorNiklas Lindgren <nikc@iki.fi>2012-09-12 19:34:59 +0300
committerStanislav Malyshev <stas@php.net>2012-09-15 23:11:12 -0700
commit27542db4e70c388346fc9983b9c7d58248aaa52d (patch)
tree9c4dfb7744f0c02e19f2c8b7335cff66909bb2ca /sapi/cli/php_http_parser.c
parent56425ee61080c5e666613e88777ee665e858b367 (diff)
downloadphp-git-27542db4e70c388346fc9983b9c7d58248aaa52d.tar.gz
Respond with 501 to unknown request methods
Fixed typo Moved 501 response from dispatch to event_read_request Return return value of send_error_page
Diffstat (limited to 'sapi/cli/php_http_parser.c')
-rw-r--r--sapi/cli/php_http_parser.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index 13b9ea12bc..4a95f82575 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -99,6 +99,7 @@ static const char *method_strings[] =
, "NOTIFY"
, "SUBSCRIBE"
, "UNSUBSCRIBE"
+ , "NOTIMPLEMENTED"
};
@@ -589,7 +590,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
case 'S': parser->method = PHP_HTTP_SUBSCRIBE; break;
case 'T': parser->method = PHP_HTTP_TRACE; break;
case 'U': parser->method = PHP_HTTP_UNLOCK; /* or UNSUBSCRIBE */ break;
- default: goto error;
+ default: parser->method = PHP_HTTP_NOT_IMPLEMENTED; break;
}
state = s_req_method;
break;
@@ -602,7 +603,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
goto error;
matcher = method_strings[parser->method];
- if (ch == ' ' && matcher[index] == '\0') {
+ if (ch == ' ' && (matcher[index] == '\0' || parser->method == PHP_HTTP_NOT_IMPLEMENTED)) {
state = s_req_spaces_before_url;
} else if (ch == matcher[index]) {
; /* nada */
@@ -631,7 +632,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
} else if (index == 4 && parser->method == PHP_HTTP_PROPFIND && ch == 'P') {
parser->method = PHP_HTTP_PROPPATCH;
} else {
- goto error;
+ parser->method = PHP_HTTP_NOT_IMPLEMENTED;
}
++index;