mirror of
https://github.com/bitinflow/server.git
synced 2026-03-13 13:35:53 +00:00
increased subdomain character limit to 63
This commit is contained in:
@@ -217,9 +217,9 @@ module.exports = function(opt) {
|
|||||||
app.get('/:req_id', function(req, res, next) {
|
app.get('/:req_id', function(req, res, next) {
|
||||||
var req_id = req.params.req_id;
|
var req_id = req.params.req_id;
|
||||||
|
|
||||||
// limit requested hostnames to 20 characters
|
// limit requested hostnames to 63 characters
|
||||||
if (! /^[a-z0-9]{4,20}$/.test(req_id)) {
|
if (! /^[a-z0-9]{4,63}$/.test(req_id)) {
|
||||||
var err = new Error('Invalid subdomain. Subdomains must be lowercase and between 4 and 20 alphanumeric characters.');
|
var err = new Error('Invalid subdomain. Subdomains must be lowercase and between 4 and 63 alphanumeric characters.');
|
||||||
err.statusCode = 403;
|
err.statusCode = 403;
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,12 +121,12 @@ test('request specific domain', function(done) {
|
|||||||
test('request domain that is too long', function(done) {
|
test('request domain that is too long', function(done) {
|
||||||
var opt = {
|
var opt = {
|
||||||
host: 'http://localhost:' + lt_server_port,
|
host: 'http://localhost:' + lt_server_port,
|
||||||
subdomain: 'thisdomainisoutsidethesizeofwhatweallow'
|
subdomain: 'thisdomainisoutsidethesizeofwhatweallowwhichissixtythreecharacters'
|
||||||
};
|
};
|
||||||
|
|
||||||
localtunnel(test._fake_port, opt, function(err, tunnel) {
|
localtunnel(test._fake_port, opt, function(err, tunnel) {
|
||||||
assert(err);
|
assert(err);
|
||||||
assert.equal(err.message, 'Invalid subdomain. Subdomains must be lowercase and between 4 and 20 alphanumeric characters.');
|
assert.equal(err.message, 'Invalid subdomain. Subdomains must be lowercase and between 4 and 63 alphanumeric characters.');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -139,7 +139,7 @@ test('request uppercase domain', function(done) {
|
|||||||
|
|
||||||
localtunnel(test._fake_port, opt, function(err, tunnel) {
|
localtunnel(test._fake_port, opt, function(err, tunnel) {
|
||||||
assert(err);
|
assert(err);
|
||||||
assert.equal(err.message, 'Invalid subdomain. Subdomains must be lowercase and between 4 and 20 alphanumeric characters.');
|
assert.equal(err.message, 'Invalid subdomain. Subdomains must be lowercase and between 4 and 63 alphanumeric characters.');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user