fix unnecessary binary->string conversion

This commit is contained in:
Joshua Slayton
2016-01-20 13:11:40 -08:00
parent 649de1b840
commit b32041d8aa

View File

@@ -19,11 +19,11 @@ util.inherits(HeaderHostTransformer, Transform);
HeaderHostTransformer.prototype._transform = function (chunk, enc, cb) {
var self = this;
chunk = chunk.toString();
// after replacing the first instance of the Host header
// we just become a regular passthrough
if (!self.replaced) {
chunk = chunk.toString();
self.push(chunk.replace(/(\r\nHost: )\S+/, function(match, $1) {
self.replaced = true;
return $1 + self.host;