From c3f90170ca70029b73a4c4f0c2cb2fa034932cae Mon Sep 17 00:00:00 2001 From: ptdorf Date: Mon, 24 Feb 2014 23:45:54 +0100 Subject: [PATCH] Update the host (and port) from the host header --- lib/http-console.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/http-console.js b/lib/http-console.js index 73cfb78..4b82a9d 100644 --- a/lib/http-console.js +++ b/lib/http-console.js @@ -177,6 +177,17 @@ this.Console.prototype = new(function () { this.exec(command.replace(/^\\/, '.')); } else if (match = command.match(/^([a-zA-Z-]+):\s*(.*)/)) { if (match[2]) { + if (match[1].toLowerCase() === 'host') { + if (match[2].indexOf(':') !== -1) { + parts = match[2].split(':'); + this.host = parts[0]; + this.port = parseInt(parts[1]) || 80; + match[2] = this.host; + } else { + this.host = match[2]; + this.port = 80; + } + } this.headers[match[1]] = match[2]; } else { delete(this.headers[match[1]]);