Skip to content

Commit

Permalink
Turned off auto-posting by default.
Browse files Browse the repository at this point in the history
 * Can opt-in to auto-posting by setting `get_max_request_entity_size` to a number. (e.g. 2048)
 * Changed URL length check to be UTF8-friendly
  • Loading branch information
kfitzgerald committed Sep 1, 2015
1 parent f247d34 commit 85b502b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/solr.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Client(options){
agent : options.agent,
secure : options.secure || false,
bigint : options.bigint || false,
get_max_request_entity_size: options.get_max_request_entity_size || 2048
get_max_request_entity_size: options.get_max_request_entity_size || false
};

// Default paths of all request handlers
Expand Down Expand Up @@ -575,9 +575,9 @@ Client.prototype.get = function(handler,query,callback){
return element;
})
.join('/'),
approxUrlLength = 10 + this.options.host.length + (this.options.port+"").length + fullPath.length; // Buffer (10) accounts for protocol and special characters like ://, port colon, and initial slash etc
approxUrlLength = 10 + Buffer.byteLength(this.options.host) + (this.options.port+"").length + Buffer.byteLength(fullPath); // Buffer (10) accounts for protocol and special characters like ://, port colon, and initial slash etc

if (approxUrlLength <= this.options.get_max_request_entity_size) {
if (this.options.get_max_request_entity_size === false || approxUrlLength <= this.options.get_max_request_entity_size) {
var params = {
host: this.options.host,
port: this.options.port,
Expand Down

0 comments on commit 85b502b

Please sign in to comment.