diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-12-05 22:42:10 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-12-09 23:57:39 +0300 |
commit | 2cb8f247512d611d3dfe81c2441e8028bfb0e8f0 (patch) | |
tree | 289bd07340834a747902da429657ab7468b2546c /src/inspector_socket.cc | |
parent | 951b1c3e09bae8395dde0d4f5cecb1fde117fa94 (diff) |
http: switch default parser to llhttp
Refs: https://github.com/nodejs/node/pull/24739
Fixes: https://github.com/nodejs/node/issues/24730
PR-URL: https://github.com/nodejs/node/pull/24870
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'src/inspector_socket.cc')
-rw-r--r-- | src/inspector_socket.cc | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index dcc42f25b4a..511f144c3f8 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -1,8 +1,6 @@ #include "inspector_socket.h" -#ifdef NODE_EXPERIMENTAL_HTTP_DEFAULT #define NODE_EXPERIMENTAL_HTTP -#endif #include "http_parser_adaptor.h" #include "util-inl.h" @@ -437,13 +435,8 @@ class HttpHandler : public ProtocolHandler { explicit HttpHandler(InspectorSocket* inspector, TcpHolder::Pointer tcp) : ProtocolHandler(inspector, std::move(tcp)), parsing_value_(false) { -#ifdef NODE_EXPERIMENTAL_HTTP_DEFAULT llhttp_init(&parser_, HTTP_REQUEST, &parser_settings); llhttp_settings_init(&parser_settings); -#else /* !NODE_EXPERIMENTAL_HTTP_DEFAULT */ - http_parser_init(&parser_, HTTP_REQUEST); - http_parser_settings_init(&parser_settings); -#endif /* NODE_EXPERIMENTAL_HTTP_DEFAULT */ parser_settings.on_header_field = OnHeaderField; parser_settings.on_header_value = OnHeaderValue; parser_settings.on_message_complete = OnMessageComplete; @@ -488,17 +481,12 @@ class HttpHandler : public ProtocolHandler { void OnData(std::vector<char>* data) override { parser_errno_t err; -#ifdef NODE_EXPERIMENTAL_HTTP_DEFAULT err = llhttp_execute(&parser_, data->data(), data->size()); if (err == HPE_PAUSED_UPGRADE) { err = HPE_OK; llhttp_resume_after_upgrade(&parser_); } -#else /* !NODE_EXPERIMENTAL_HTTP_DEFAULT */ - http_parser_execute(&parser_, &parser_settings, data->data(), data->size()); - err = HTTP_PARSER_ERRNO(&parser_); -#endif /* NODE_EXPERIMENTAL_HTTP_DEFAULT */ data->clear(); if (err != HPE_OK) { CancelHandshake(); |