fix bad matching against subdomains

Match for valid subdomains versus anything that comes before a period.

fixes #7
This commit is contained in:
Roman Shtylman
2014-04-20 12:56:26 -04:00
parent 8abb4f395f
commit 8cc22d501c
4 changed files with 35 additions and 10 deletions

View File

@@ -15,6 +15,33 @@ test('setup localtunnel server', function(done) {
});
});
test('landing page', function(done) {
var opt = {
host: 'localhost',
port: lt_server_port,
headers: {
host: 'example.com'
},
path: '/'
}
var req = http.request(opt, function(res) {
res.setEncoding('utf8');
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
assert(body.indexOf('<h2>expose yourself to the world</h2>') > 0);
done();
});
});
req.end();
});
test('setup local http server', function(done) {
var server = http.createServer();
server.on('request', function(req, res) {
@@ -52,7 +79,7 @@ test('query localtunnel server w/ ident', function(done) {
host: 'localhost',
port: lt_server_port,
headers: {
host: hostname
host: hostname + '.tld'
},
path: '/'
}

View File

@@ -61,7 +61,7 @@ test('query localtunnel server w/ ident', function(done) {
port: lt_server_port,
agent: false,
headers: {
host: hostname
host: hostname + '.tld'
},
path: '/'
}