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

http: remove obsolete function escapeHeaderValue #24173

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
11 changes: 2 additions & 9 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ function processHeader(self, state, key, value, validate) {
function storeHeader(self, state, key, value, validate) {
if (validate)
validateHeaderValue(key, value);
state.header += key + ': ' + escapeHeaderValue(value) + CRLF;
state.header += key + ': ' + value + CRLF;
matchHeader(self, state, key, value);
}

Expand Down Expand Up @@ -642,13 +642,6 @@ function connectionCorkNT(msg, conn) {
}


function escapeHeaderValue(value) {
// Protect against response splitting. The regex test is there to
// minimize the performance impact in the common case.
return /[\r\n]/.test(value) ? value.replace(/[\r\n]+[ \t]*/g, '') : value;
}


OutgoingMessage.prototype.addTrailers = function addTrailers(headers) {
this._trailer = '';
var keys = Object.keys(headers);
Expand All @@ -670,7 +663,7 @@ OutgoingMessage.prototype.addTrailers = function addTrailers(headers) {
debug('Trailer "%s" contains invalid characters', field);
throw new ERR_INVALID_CHAR('trailer content', field);
}
this._trailer += field + ': ' + escapeHeaderValue(value) + CRLF;
this._trailer += field + ': ' + value + CRLF;
}
};

Expand Down