Commit 8c32109d authored by gejun's avatar gejun

still parse body when the http request contains upgrade header

parent 40b13429
......@@ -513,8 +513,7 @@ std::ostream& operator<<(std::ostream& os, const http_parser& parser) {
if (parser.type == HTTP_REQUEST || parser.type == HTTP_BOTH) {
os << " method=" << HttpMethod2Str((HttpMethod)parser.method);
}
os << " upgrade=" << parser.upgrade
<< " data=" << parser.data
os << " data=" << parser.data
<< '}';
return os;
}
......
......@@ -1741,10 +1741,6 @@ size_t http_parser_execute (http_parser *parser,
parser->state = s_headers_done;
/* Set this here so that on_headers_complete() callbacks can see it */
parser->upgrade =
(parser->flags & F_UPGRADE || parser->method == HTTP_CONNECT);
/* Here we call the headers_complete callback. This is somewhat
* different than other callbacks because if the user returns 1, we
* will interpret that as saying that this message has no body. This
......@@ -1783,7 +1779,7 @@ size_t http_parser_execute (http_parser *parser,
parser->nread = 0;
/* Exit, the rest of the connect is in a different protocol. */
if (parser->upgrade) {
if (parser->method == HTTP_CONNECT) {
parser->state = NEW_MESSAGE();
CALLBACK_NOTIFY(message_complete);
return (p - data) + 1;
......
......@@ -216,13 +216,7 @@ struct http_parser {
unsigned int status_code : 16; /* responses only */
unsigned int method : 8; /* requests only */
unsigned int http_errno : 7;
/* 1 = Upgrade header was present and the parser has exited because of that.
* 0 = No upgrade header present.
* Should be checked when http_parser_execute() returns in addition to
* error checking.
*/
unsigned int upgrade : 1;
unsigned int dummy : 1;
/** PUBLIC **/
void *data; /* A pointer to get hook to the "connection" or "socket" object */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment