Merge pull request #108 from joshuaxls/master

Fix bug w/ HeaderHostTransformer and binary data
This commit is contained in:
Roman Shtylman
2016-01-20 13:29:50 -08:00

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;