Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 35d2397

Browse filesBrowse files
Lauri Piisangcodebytere
authored andcommitted
http: remove obsolete function escapeHeaderValue
There are test cases which validate the useful path of the function never runs the functionality of it is obsoleted by checkInvalidHeaderChar PR-URL: #24173 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent b29b235 commit 35d2397
Copy full SHA for 35d2397

File tree

Expand file treeCollapse file tree

1 file changed

+2
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-9
lines changed
Open diff view settings
Collapse file

‎lib/_http_outgoing.js‎

Copy file name to clipboardExpand all lines: lib/_http_outgoing.js
+2-9Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ function processHeader(self, state, key, value, validate) {
409409
function storeHeader(self, state, key, value, validate) {
410410
if (validate)
411411
validateHeaderValue(key, value);
412-
state.header += key + ': ' + escapeHeaderValue(value) + CRLF;
412+
state.header += key + ': ' + value + CRLF;
413413
matchHeader(self, state, key, value);
414414
}
415415

@@ -642,13 +642,6 @@ function connectionCorkNT(msg, conn) {
642642
}
643643

644644

645-
function escapeHeaderValue(value) {
646-
// Protect against response splitting. The regex test is there to
647-
// minimize the performance impact in the common case.
648-
return /[\r\n]/.test(value) ? value.replace(/[\r\n]+[ \t]*/g, '') : value;
649-
}
650-
651-
652645
OutgoingMessage.prototype.addTrailers = function addTrailers(headers) {
653646
this._trailer = '';
654647
var keys = Object.keys(headers);
@@ -670,7 +663,7 @@ OutgoingMessage.prototype.addTrailers = function addTrailers(headers) {
670663
debug('Trailer "%s" contains invalid characters', field);
671664
throw new ERR_INVALID_CHAR('trailer content', field);
672665
}
673-
this._trailer += field + ': ' + escapeHeaderValue(value) + CRLF;
666+
this._trailer += field + ': ' + value + CRLF;
674667
}
675668
};
676669

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.