Skip to content

Commit 1aea1e3

Browse files
mcollinaMylesBorins
authored andcommitted
http: fix regression of binary upgrade response body
PR-URL: #25039 Fixes: #24958 Reviewed-By: Myles Borins <myles.borins@gmail.com>
1 parent 728bc63 commit 1aea1e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/node_http_parser.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,6 @@ class Parser : public AsyncWrap, public StreamListener {
605605
size_t nparsed =
606606
http_parser_execute(&parser_, &settings, data, len);
607607

608-
enum http_errno err = HTTP_PARSER_ERRNO(&parser_);
609-
610608
Save();
611609

612610
// Unassign the 'buffer_' variable
@@ -621,7 +619,9 @@ class Parser : public AsyncWrap, public StreamListener {
621619
Local<Integer> nparsed_obj = Integer::New(env()->isolate(), nparsed);
622620
// If there was a parse error in one of the callbacks
623621
// TODO(bnoordhuis) What if there is an error on EOF?
624-
if ((!parser_.upgrade && nparsed != len) || err != HPE_OK) {
622+
if (!parser_.upgrade && nparsed != len) {
623+
enum http_errno err = HTTP_PARSER_ERRNO(&parser_);
624+
625625
Local<Value> e = Exception::Error(env()->parse_error_string());
626626
Local<Object> obj = e->ToObject(env()->isolate()->GetCurrentContext())
627627
.ToLocalChecked();

0 commit comments

Comments
 (0)