Skip to content

Commit

Permalink
http: do not use llhttp indexes for array
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Feb 12, 2024
1 parent eff5939 commit b7c9b5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node_http_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1288,9 +1288,11 @@ void InitializeHttpParser(Local<Object> target,
Integer::NewFromUnsigned(env->isolate(), kLenientAll));

Local<Array> methods = Array::New(env->isolate());
size_t method_index = -1;
#define V(num, name, string) \
methods->Set(env->context(), \
num, FIXED_ONE_BYTE_STRING(env->isolate(), #string)).Check();
++method_index, \
FIXED_ONE_BYTE_STRING(env->isolate(), #string)).Check();
HTTP_METHOD_MAP(V)
#undef V
target->Set(env->context(),
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-http-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const methods = [
'PROPPATCH',
'PURGE',
'PUT',
'QUERY',
'REBIND',
'REPORT',
'SEARCH',
Expand Down

0 comments on commit b7c9b5d

Please sign in to comment.