Comparing version 1.2.1 to 1.2.2
22 Apr 2015, version 1.2.2 | ||
- fix access control regression in `1.2.1` (issue [#238](https://github.com/rlidwka/sinopia/issues/238)) | ||
- add a possibility to bind on unix sockets (issue [#237](https://github.com/rlidwka/sinopia/issues/237)) | ||
11 Apr 2015, version 1.2.1 | ||
@@ -3,0 +8,0 @@ |
@@ -157,7 +157,7 @@ var Crypto = require('crypto') | ||
if (typeof(p.allow_access) !== 'function') { | ||
if (typeof(p.allow_publish) !== 'function') { | ||
return next() | ||
} | ||
p.allow_access(user, package, function(err, ok) { | ||
p.allow_publish(user, package, function(err, ok) { | ||
if (err) return callback(err) | ||
@@ -164,0 +164,0 @@ if (ok) return callback(null, ok) |
@@ -80,5 +80,5 @@ #!/usr/bin/env node | ||
addresses = addresses.map(function(addr) { | ||
addr = Utils.parse_address(addr) | ||
var parsed_addr = Utils.parse_address(addr) | ||
if (!addr) { | ||
if (!parsed_addr) { | ||
logger.logger.warn({ addr: addr }, | ||
@@ -90,3 +90,3 @@ 'invalid address - @{addr}, we expect a port (e.g. "4873"),' | ||
return addr | ||
return parsed_addr | ||
@@ -147,3 +147,3 @@ }).filter(Boolean) | ||
webServer | ||
.listen(addr.port, addr.host) | ||
.listen(addr.port || addr.path, addr.host) | ||
.on('error', function(err) { | ||
@@ -155,8 +155,14 @@ logger.logger.fatal({ err: err }, 'cannot create server: @{err.message}') | ||
logger.logger.warn({ | ||
addr: URL.format({ | ||
protocol: addr.proto, | ||
hostname: addr.host, | ||
port: addr.port, | ||
pathname: '/', | ||
}), | ||
addr: ( addr.path | ||
? URL.format({ | ||
protocol: 'unix', | ||
pathname: addr.path, | ||
}) | ||
: URL.format({ | ||
protocol: addr.proto, | ||
hostname: addr.host, | ||
port: addr.port, | ||
pathname: '/', | ||
}) | ||
), | ||
version: 'Sinopia/'+pkg.version, | ||
@@ -163,0 +169,0 @@ }, 'http address - @{addr}') |
@@ -129,15 +129,17 @@ var assert = require('assert') | ||
// | ||
// - https:localhost:1234 - protocol + host + port | ||
// - localhost:1234 - host + port | ||
// - 1234 - port | ||
// - http::1234 - protocol + port | ||
// - https://localhost:443/ - full url + https | ||
// - http://[::1]:443/ - ipv6 | ||
// - https:localhost:1234 - protocol + host + port | ||
// - localhost:1234 - host + port | ||
// - 1234 - port | ||
// - http::1234 - protocol + port | ||
// - https://localhost:443/ - full url + https | ||
// - http://[::1]:443/ - ipv6 | ||
// - unix:/tmp/http.sock - unix sockets | ||
// - https://unix:/tmp/http.sock - unix sockets (https) | ||
// | ||
// TODO: refactor it to something more reasonable? | ||
// | ||
// protocol : // ( host )|( ipv6 ): port / | ||
var m = /^((https?):(\/\/)?)?((([^\/:]*)|\[([^\[\]]+)\]):)?(\d+)\/?$/.exec(addr) | ||
if (!m) return null | ||
return { | ||
if (m) return { | ||
proto: m[2] || 'http', | ||
@@ -147,2 +149,11 @@ host: m[6] || m[7] || 'localhost', | ||
} | ||
var m = /^((https?):(\/\/)?)?unix:(.*)$/.exec(addr) | ||
if (m) return { | ||
proto: m[2] || 'http', | ||
path: m[4], | ||
} | ||
return null | ||
} | ||
@@ -149,0 +160,0 @@ |
{ | ||
"name": "sinopia", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "async": { |
@@ -1,1 +0,1 @@ | ||
{"name":"sinopia","version":"1.2.1","description":"Private npm repository server","author":{"name":"Alex Kocharin","email":"alex@kocharin.ru"},"repository":{"type":"git","url":"git://github.com/rlidwka/sinopia"},"main":"index.js","bin":{"sinopia":"./bin/sinopia"},"dependencies":{"express":">=5.0.0-0 <6.0.0-0","express-json5":">=0.1.0 <1.0.0-0","body-parser":">=1.9.2 <2.0.0-0","compression":">=1.2.0 <2.0.0-0","commander":">=2.3.0 <3.0.0-0","js-yaml":">=3.0.1 <4.0.0-0","cookies":">=0.5.0 <1.0.0-0","request":">=2.31.0 <3.0.0-0","async":">=0.9.0 <1.0.0-0","es6-shim":"0.21.x","semver":">=2.2.1 <5.0.0-0","minimatch":">=0.2.14 <2.0.0-0","bunyan":">=0.22.1 <2.0.0-0","handlebars":"2.x","highlight.js":"8.x","lunr":">=0.5.2 <1.0.0-0","render-readme":">=0.2.1","jju":"1.x","mkdirp":">=0.3.5 <1.0.0-0","sinopia-htpasswd":">= 0.4.3","http-errors":">=1.2.0"},"optionalDependencies":{"fs-ext":">=0.4.1 <1.0.0-0","crypt3":">=0.1.6 <1.0.0-0"},"devDependencies":{"rimraf":">=2.2.5 <3.0.0-0","bluebird":"2 >=2.9","mocha":"2 >=2.2.3","eslint":">= 0.18","browserify":"7.x","browserify-handlebars":"1.x","grunt":">=0.4.4 <1.0.0-0","grunt-cli":"*","grunt-browserify":">=2.0.8 <3.0.0-0","grunt-contrib-less":">=0.11.0 <1.0.0-0","grunt-contrib-watch":">=0.6.1 <1.0.0-0","unopinionate":">=0.0.4 <1.0.0-0","onclick":">=0.1.0 <1.0.0-0","transition-complete":">=0.0.2 <1.0.0-0"},"keywords":["private","package","repository","registry","modules","proxy","server"],"scripts":{"test":"eslint --reset . && mocha ./test/functional ./test/unit","test-travis":"eslint --reset . && mocha -R spec ./test/functional ./test/unit","test-only":"mocha ./test/functional ./test/unit","lint":"eslint --reset .","prepublish":"js-yaml package.yaml > package.json","clean-shrinkwrap":"node -e '\n function clean(j) {\n if (!j) return\n for (var k in j) {\n delete j[k].from\n delete j[k].resolved\n if (j[k].dependencies) clean(j[k].dependencies)\n }\n }\n x = JSON.parse(require(\"fs\").readFileSync(\"./npm-shrinkwrap.json\"))\n clean(x.dependencies)\n x = JSON.stringify(x, null, \" \")\n require(\"fs\").writeFileSync(\"./npm-shrinkwrap.json\", x + \"\\n\")\n'\n"},"engines":{"node":">=0.10"},"preferGlobal":true,"publishConfig":{"registry":"https://registry.npmjs.org/"},"license":{"type":"WTFPL","url":"http://www.wtfpl.net/txt/copying/"}} | ||
{"name":"sinopia","version":"1.2.2","description":"Private npm repository server","author":{"name":"Alex Kocharin","email":"alex@kocharin.ru"},"repository":{"type":"git","url":"git://github.com/rlidwka/sinopia"},"main":"index.js","bin":{"sinopia":"./bin/sinopia"},"dependencies":{"express":">=5.0.0-0 <6.0.0-0","express-json5":">=0.1.0 <1.0.0-0","body-parser":">=1.9.2 <2.0.0-0","compression":">=1.2.0 <2.0.0-0","commander":">=2.3.0 <3.0.0-0","js-yaml":">=3.0.1 <4.0.0-0","cookies":">=0.5.0 <1.0.0-0","request":">=2.31.0 <3.0.0-0","async":">=0.9.0 <1.0.0-0","es6-shim":"0.21.x","semver":">=2.2.1 <5.0.0-0","minimatch":">=0.2.14 <2.0.0-0","bunyan":">=0.22.1 <2.0.0-0","handlebars":"2.x","highlight.js":"8.x","lunr":">=0.5.2 <1.0.0-0","render-readme":">=0.2.1","jju":"1.x","mkdirp":">=0.3.5 <1.0.0-0","sinopia-htpasswd":">= 0.4.3","http-errors":">=1.2.0"},"optionalDependencies":{"fs-ext":">=0.4.1 <1.0.0-0","crypt3":">=0.1.6 <1.0.0-0"},"devDependencies":{"rimraf":">=2.2.5 <3.0.0-0","bluebird":"2 >=2.9","mocha":"2 >=2.2.3","eslint":">= 0.18","browserify":"7.x","browserify-handlebars":"1.x","grunt":">=0.4.4 <1.0.0-0","grunt-cli":"*","grunt-browserify":">=2.0.8 <3.0.0-0","grunt-contrib-less":">=0.11.0 <1.0.0-0","grunt-contrib-watch":">=0.6.1 <1.0.0-0","unopinionate":">=0.0.4 <1.0.0-0","onclick":">=0.1.0 <1.0.0-0","transition-complete":">=0.0.2 <1.0.0-0"},"keywords":["private","package","repository","registry","modules","proxy","server"],"scripts":{"test":"eslint --reset . && mocha ./test/functional ./test/unit","test-travis":"eslint --reset . && mocha -R spec ./test/functional ./test/unit","test-only":"mocha ./test/functional ./test/unit","lint":"eslint --reset .","prepublish":"js-yaml package.yaml > package.json","clean-shrinkwrap":"node -e '\n function clean(j) {\n if (!j) return\n for (var k in j) {\n delete j[k].from\n delete j[k].resolved\n if (j[k].dependencies) clean(j[k].dependencies)\n }\n }\n x = JSON.parse(require(\"fs\").readFileSync(\"./npm-shrinkwrap.json\"))\n clean(x.dependencies)\n x = JSON.stringify(x, null, \" \")\n require(\"fs\").writeFileSync(\"./npm-shrinkwrap.json\", x + \"\\n\")\n'\n"},"engines":{"node":">=0.10"},"preferGlobal":true,"publishConfig":{"registry":"https://registry.npmjs.org/"},"license":{"type":"WTFPL","url":"http://www.wtfpl.net/txt/copying/"}} |
@@ -48,2 +48,3 @@ //require('es6-shim') | ||
require('./access')() | ||
require('./basic')() | ||
@@ -50,0 +51,0 @@ require('./gh29')() |
@@ -9,3 +9,3 @@ var assert = require('assert') | ||
assert.strictEqual(parse(what), null) | ||
} else { | ||
} else if (port) { | ||
assert.deepEqual(parse(what), { | ||
@@ -16,2 +16,7 @@ proto: proto, | ||
}) | ||
} else { | ||
assert.deepEqual(parse(what), { | ||
proto: proto, | ||
path: host, | ||
}) | ||
} | ||
@@ -31,5 +36,10 @@ }) | ||
addTest('unix:/tmp/foo.sock', 'http', '/tmp/foo.sock') | ||
addTest('http:unix:foo.sock', 'http', 'foo.sock') | ||
addTest('https://unix:foo.sock', 'https', 'foo.sock') | ||
addTest('blah', null) | ||
addTest('blah://4873', null) | ||
addTest('https://blah:4873///', null) | ||
addTest('unix:1234', 'http', 'unix', '1234') // not unix socket | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
762594
103
21611