@@ -604,15 +604,20 @@ size_t php_http_parser_execute (php_http_parser *parser,
604
604
goto error ;
605
605
606
606
matcher = method_strings [parser -> method ];
607
- if (ch == ' ' && (matcher [index ] == '\0' || parser -> method == PHP_HTTP_NOT_IMPLEMENTED )) {
607
+ if (ch == ' ' ) {
608
+ if (parser -> method != PHP_HTTP_NOT_IMPLEMENTED && matcher [index ] != '\0' ) {
609
+ parser -> method = PHP_HTTP_NOT_IMPLEMENTED ;
610
+ }
608
611
state = s_req_spaces_before_url ;
609
- } else if (ch == matcher [index ]) {
612
+ } else if (parser -> method == PHP_HTTP_NOT_IMPLEMENTED || ch == matcher [index ]) {
610
613
; /* nada */
611
614
} else if (parser -> method == PHP_HTTP_CONNECT ) {
612
615
if (index == 1 && ch == 'H' ) {
613
616
parser -> method = PHP_HTTP_CHECKOUT ;
614
617
} else if (index == 2 && ch == 'P' ) {
615
618
parser -> method = PHP_HTTP_COPY ;
619
+ } else {
620
+ parser -> method = PHP_HTTP_NOT_IMPLEMENTED ;
616
621
}
617
622
} else if (parser -> method == PHP_HTTP_MKCOL ) {
618
623
if (index == 1 && ch == 'O' ) {
@@ -623,6 +628,8 @@ size_t php_http_parser_execute (php_http_parser *parser,
623
628
parser -> method = PHP_HTTP_MSEARCH ;
624
629
} else if (index == 2 && ch == 'A' ) {
625
630
parser -> method = PHP_HTTP_MKACTIVITY ;
631
+ } else {
632
+ parser -> method = PHP_HTTP_NOT_IMPLEMENTED ;
626
633
}
627
634
} else if (index == 1 && parser -> method == PHP_HTTP_POST && ch == 'R' ) {
628
635
parser -> method = PHP_HTTP_PROPFIND ; /* or HTTP_PROPPATCH */
0 commit comments