mirror of
https://github.com/bitinflow/localtunnel.git
synced 2026-03-16 23:15:54 +00:00
fixed Host header replacement - remembers if header is already replaced and does not remove _transform method
This commit is contained in:
12
client.js
12
client.js
@@ -30,10 +30,14 @@ HeaderHostTransformer.prototype._transform = function (chunk, enc, cb) {
|
|||||||
|
|
||||||
// after replacing the first instance of the Host header
|
// after replacing the first instance of the Host header
|
||||||
// we just become a regular passthrough
|
// we just become a regular passthrough
|
||||||
self.push(chunk.replace(/(\r\nHost: )\S+/, function(match, $1) {
|
if (!self.replaced) {
|
||||||
self._transform = undefined;
|
self.push(chunk.replace(/(\r\nHost: )\S+/, function(match, $1) {
|
||||||
return $1 + self.host;
|
self.replaced = true;
|
||||||
}));
|
return $1 + self.host;
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
self.push(chunk);
|
||||||
|
}
|
||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user