solr-proxy
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -0,1 +1,6 @@ | ||
4.0.0 | ||
===== | ||
* Add new option `maxRows` that defaults to `200`. | ||
3.0.0 | ||
@@ -2,0 +7,0 @@ ===== |
34
index.js
@@ -18,8 +18,27 @@ var { URL } = require('url') | ||
return options.validHttpMethods.indexOf(request.method) !== -1 && | ||
options.validPaths.indexOf(path) !== -1 && | ||
queryParams.every(function (p) { | ||
var paramPrefix = p[0].split('.')[0] // invalidate not just "stream", but "stream.*" | ||
return options.invalidParams.indexOf(paramPrefix) === -1 | ||
}) | ||
if (options.validHttpMethods.indexOf(request.method) === -1) { | ||
return false | ||
} | ||
if (options.validPaths.indexOf(path) === -1) { | ||
return false | ||
} | ||
if (queryParams.some(function (p) { | ||
// This function should return "true" for invalid cases. Confusing, I know. | ||
var paramPrefix = p[0].split('.')[0] // invalidate not just "stream", but "stream.*" | ||
if (paramPrefix === 'rows') { | ||
var rows = +p[1] | ||
if (rows > options.maxRows) { | ||
return true | ||
} | ||
} | ||
return options.invalidParams.indexOf(paramPrefix) !== -1 | ||
})) { | ||
return false | ||
} | ||
return true | ||
} | ||
@@ -35,3 +54,4 @@ | ||
port: 8080 | ||
} | ||
}, | ||
maxRows: 200 | ||
} | ||
@@ -38,0 +58,0 @@ |
@@ -26,2 +26,6 @@ var createProxyOptions = function (argv) { | ||
if (+argv.maxRows) { | ||
proxyOptions.maxRows = +argv.maxRows | ||
} | ||
return proxyOptions | ||
@@ -42,2 +46,3 @@ } | ||
' delimited)\n' + | ||
' --maxRows Maximum rows permitted in a request [default: 200]\n' + | ||
' --quiet, -q Do not write messages to STDOUT\n' + | ||
@@ -44,0 +49,0 @@ ' --version, -v Show version\n' + |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"author": "Rich Trott <rtrott@gmail.com>", | ||
@@ -13,0 +13,0 @@ "bugs": { |
@@ -37,8 +37,11 @@ solr-proxy | ||
``` | ||
--port Listen on this port [default: 8008] | ||
--backendPort Solr backend port [default: 8080] | ||
--backendHost Solr backend host [default: "localhost"] | ||
--validPaths Allowed paths (comma separated) [default: "/solr/select"] | ||
--invalidParams Blocked parameters (comma separated) [default: "qt,stream"] | ||
--validMethods Allowed HTTP methods (comma separated) [default: "GET"] | ||
--port Listen on this port [default: 8008] | ||
--backendPort Solr backend port [default: 8080] | ||
--backendHost Solr backend host [default: "localhost"] | ||
--validPaths Allowed paths (comma delimited) [default: "/solr/select"] | ||
--invalidParams Blocked parameters (comma [default: "qt,stream"] | ||
delimited) | ||
--validMethods Allowed HTTP methods (comma [default: "GET"] | ||
delimited) | ||
--maxRows Maximum rows permitted in a request [default: 200] | ||
--quiet, -q Do not write messages to STDOUT | ||
@@ -45,0 +48,0 @@ --version, -v Show version |
11033
150
113