File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1790,10 +1790,15 @@ size_t http_parser_execute (http_parser *parser,
17901790 UPDATE_STATE (s_headers_done );
17911791
17921792 /* Set this here so that on_headers_complete() callbacks can see it */
1793+ #if HTTP_PARSER_STRICT
17931794 parser -> upgrade =
17941795 ((parser -> flags & (F_UPGRADE | F_CONNECTION_UPGRADE )) ==
17951796 (F_UPGRADE | F_CONNECTION_UPGRADE ) ||
17961797 parser -> method == HTTP_CONNECT );
1798+ #else
1799+ parser -> upgrade = (parser -> flags & F_UPGRADE ) ||
1800+ parser -> method == HTTP_CONNECT ;
1801+ #endif
17971802
17981803 /* Here we call the headers_complete callback. This is somewhat
17991804 * different than other callbacks because if the user returns 1, we
Original file line number Diff line number Diff line change @@ -1036,6 +1036,30 @@ const struct message requests[] =
10361036 ,.body = ""
10371037 }
10381038
1039+ #if !HTTP_PARSER_STRICT
1040+ #define CONNECTION_UPGRADE_REGRESSION 38
1041+ , {.name = "upgrade header with some random words"
1042+ ,.type = HTTP_REQUEST
1043+ ,.raw = "GET / HTTP/1.1\r\n"
1044+ "Upgrade: Yes, please.\r\n"
1045+ "\r\n"
1046+ ,.should_keep_alive = TRUE
1047+ ,.message_complete_on_eof = FALSE
1048+ ,.http_major = 1
1049+ ,.http_minor = 1
1050+ ,.method = HTTP_GET
1051+ ,.query_string = ""
1052+ ,.fragment = ""
1053+ ,.request_path = "/"
1054+ ,.request_url = "/"
1055+ ,.num_headers = 1
1056+ ,.upgrade = ""
1057+ ,.headers = { { "Upgrade" , "Yes, please." }
1058+ }
1059+ ,.body = ""
1060+ }
1061+ #endif
1062+
10391063, {.name = NULL } /* sentinel */
10401064};
10411065
You can’t perform that action at this time.
0 commit comments