Set http_major when a request omits the HTTP version

I.E. "GET /" in telnet
event_stream
Nathan Rajlich 14 years ago committed by Ryan Dahl
parent cae8a96c16
commit 84578ae7a8

@ -738,12 +738,14 @@ size_t http_parser_execute (http_parser *parser,
case CR:
CALLBACK(url);
CALLBACK(path);
parser->http_major = 0;
parser->http_minor = 9;
state = s_req_line_almost_done;
break;
case LF:
CALLBACK(url);
CALLBACK(path);
parser->http_major = 0;
parser->http_minor = 9;
state = s_header_field_start;
break;
@ -778,11 +780,13 @@ size_t http_parser_execute (http_parser *parser,
break;
case CR:
CALLBACK(url);
parser->http_major = 0;
parser->http_minor = 9;
state = s_req_line_almost_done;
break;
case LF:
CALLBACK(url);
parser->http_major = 0;
parser->http_minor = 9;
state = s_header_field_start;
break;
@ -811,12 +815,14 @@ size_t http_parser_execute (http_parser *parser,
case CR:
CALLBACK(url);
CALLBACK(query_string);
parser->http_major = 0;
parser->http_minor = 9;
state = s_req_line_almost_done;
break;
case LF:
CALLBACK(url);
CALLBACK(query_string);
parser->http_major = 0;
parser->http_minor = 9;
state = s_header_field_start;
break;
@ -845,11 +851,13 @@ size_t http_parser_execute (http_parser *parser,
break;
case CR:
CALLBACK(url);
parser->http_major = 0;
parser->http_minor = 9;
state = s_req_line_almost_done;
break;
case LF:
CALLBACK(url);
parser->http_major = 0;
parser->http_minor = 9;
state = s_header_field_start;
break;
@ -878,12 +886,14 @@ size_t http_parser_execute (http_parser *parser,
case CR:
CALLBACK(url);
CALLBACK(fragment);
parser->http_major = 0;
parser->http_minor = 9;
state = s_req_line_almost_done;
break;
case LF:
CALLBACK(url);
CALLBACK(fragment);
parser->http_major = 0;
parser->http_minor = 9;
state = s_header_field_start;
break;

@ -538,6 +538,25 @@ const struct message requests[] =
,.body= ""
}
#define NO_HTTP_VERSION 19
, {.name= "request with no http version"
,.type= HTTP_REQUEST
,.raw= "GET /\r\n"
"\r\n"
,.should_keep_alive= FALSE
,.message_complete_on_eof= FALSE
,.http_major= 0
,.http_minor= 9
,.method= HTTP_GET
,.query_string= ""
,.fragment= ""
,.request_path= "/"
,.request_url= "/"
,.num_headers= 0
,.headers= {}
,.body= ""
}
, {.name= NULL } /* sentinel */
};

Loading…
Cancel
Save