Skip to content

Commit 1422997

Browse files
authored
perf: set isLowerCase param on all calls of HeadersList.append (#3468)
1 parent c593564 commit 1422997

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

lib/web/cookies/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function setCookie (headers, cookie) {
102102
const str = stringify(cookie)
103103

104104
if (str) {
105-
headers.append('Set-Cookie', str)
105+
headers.append('set-cookie', str, true)
106106
}
107107
}
108108

lib/web/fetch/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ async function httpNetworkOrCacheFetch (
14601460
// user agents should append `User-Agent`/default `User-Agent` value to
14611461
// httpRequest’s header list.
14621462
if (!httpRequest.headersList.contains('user-agent', true)) {
1463-
httpRequest.headersList.append('user-agent', defaultUserAgent)
1463+
httpRequest.headersList.append('user-agent', defaultUserAgent, true)
14641464
}
14651465

14661466
// 15. If httpRequest’s cache mode is "default" and httpRequest’s header

lib/web/fetch/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class Request {
520520
// not contain `Content-Type`, then append `Content-Type`/Content-Type to
521521
// this’s headers.
522522
if (contentType && !getHeadersList(this[kHeaders]).contains('content-type', true)) {
523-
this[kHeaders].append('content-type', contentType)
523+
this[kHeaders].append('content-type', contentType, true)
524524
}
525525
}
526526

lib/web/websocket/connection.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ try {
2222
* @param {URL} url
2323
* @param {string|string[]} protocols
2424
* @param {import('./websocket').Handler} handler
25-
* @param {Partial<import('../../types/websocket').WebSocketInit>} options
25+
* @param {Partial<import('../../../types/websocket').WebSocketInit>} options
2626
*/
2727
function establishWebSocketConnection (url, protocols, client, handler, options) {
2828
// 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s
@@ -65,17 +65,17 @@ function establishWebSocketConnection (url, protocols, client, handler, options)
6565

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

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

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

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

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

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

0 commit comments

Comments
 (0)