Skip to content

Commit

Permalink
perf: set isLowerCase param on all calls of HeadersList.append (#3468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Aug 17, 2024
1 parent c593564 commit 1422997
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/web/cookies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function setCookie (headers, cookie) {
const str = stringify(cookie)

if (str) {
headers.append('Set-Cookie', str)
headers.append('set-cookie', str, true)
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/web/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ async function httpNetworkOrCacheFetch (
// user agents should append `User-Agent`/default `User-Agent` value to
// httpRequest’s header list.
if (!httpRequest.headersList.contains('user-agent', true)) {
httpRequest.headersList.append('user-agent', defaultUserAgent)
httpRequest.headersList.append('user-agent', defaultUserAgent, true)
}

// 15. If httpRequest’s cache mode is "default" and httpRequest’s header
Expand Down
2 changes: 1 addition & 1 deletion lib/web/fetch/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class Request {
// not contain `Content-Type`, then append `Content-Type`/Content-Type to
// this’s headers.
if (contentType && !getHeadersList(this[kHeaders]).contains('content-type', true)) {
this[kHeaders].append('content-type', contentType)
this[kHeaders].append('content-type', contentType, true)
}
}

Expand Down
10 changes: 5 additions & 5 deletions lib/web/websocket/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
* @param {URL} url
* @param {string|string[]} protocols
* @param {import('./websocket').Handler} handler
* @param {Partial<import('../../types/websocket').WebSocketInit>} options
* @param {Partial<import('../../../types/websocket').WebSocketInit>} options
*/
function establishWebSocketConnection (url, protocols, client, handler, options) {
// 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s
Expand Down Expand Up @@ -65,17 +65,17 @@ function establishWebSocketConnection (url, protocols, client, handler, options)

// 6. Append (`Sec-WebSocket-Key`, keyValue) to request’s
// header list.
request.headersList.append('sec-websocket-key', keyValue)
request.headersList.append('sec-websocket-key', keyValue, true)

// 7. Append (`Sec-WebSocket-Version`, `13`) to request’s
// header list.
request.headersList.append('sec-websocket-version', '13')
request.headersList.append('sec-websocket-version', '13', true)

// 8. For each protocol in protocols, combine
// (`Sec-WebSocket-Protocol`, protocol) in request’s header
// list.
for (const protocol of protocols) {
request.headersList.append('sec-websocket-protocol', protocol)
request.headersList.append('sec-websocket-protocol', protocol, true)
}

// 9. Let permessageDeflate be a user-agent defined
Expand All @@ -85,7 +85,7 @@ function establishWebSocketConnection (url, protocols, client, handler, options)

// 10. Append (`Sec-WebSocket-Extensions`, permessageDeflate) to
// request’s header list.
request.headersList.append('sec-websocket-extensions', permessageDeflate)
request.headersList.append('sec-websocket-extensions', permessageDeflate, true)

// 11. Fetch request with useParallelQueue set to true, and
// processResponse given response being these steps:
Expand Down

0 comments on commit 1422997

Please sign in to comment.