mirror of
https://github.com/bitinflow/localtunnel.git
synced 2026-03-13 13:35: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
|
||||
// we just become a regular passthrough
|
||||
self.push(chunk.replace(/(\r\nHost: )\S+/, function(match, $1) {
|
||||
self._transform = undefined;
|
||||
return $1 + self.host;
|
||||
}));
|
||||
if (!self.replaced) {
|
||||
self.push(chunk.replace(/(\r\nHost: )\S+/, function(match, $1) {
|
||||
self.replaced = true;
|
||||
return $1 + self.host;
|
||||
}));
|
||||
} else {
|
||||
self.push(chunk);
|
||||
}
|
||||
cb();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user