Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: refactor counter in mapToHeaders inner loop #32012

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/internal/http2/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,13 @@ function mapToHeaders(map,
let count = 0;
const keys = ObjectKeys(map);
const singles = new Set();
let i;
let i, j;
let isArray;
let key;
let value;
let isSingleValueHeader;
let err;
for (i = 0; i < keys.length; i++) {
for (i = 0; i < keys.length; ++i) {
key = keys[i];
value = map[key];
if (value === undefined || key === '')
Expand Down Expand Up @@ -488,8 +488,8 @@ function mapToHeaders(map,
throw new ERR_HTTP2_INVALID_CONNECTION_HEADERS(key);
}
if (isArray) {
for (var k = 0; k < value.length; k++) {
const val = String(value[k]);
for (j = 0; j < value.length; ++j) {
const val = String(value[j]);
ret += `${key}\0${val}\0`;
}
count += value.length;
Expand Down