Skip to content

Commit

Permalink
http: remove obsolete function escapeHeaderValue
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
Lauri Piisang authored and BridgeAR committed Nov 13, 2018
1 parent 89c3388 commit c2599a1
Showing 1 changed file with 2 additions and 9 deletions.
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

0 comments on commit c2599a1

Please sign in to comment.