elasticsearch-transport 5.0.4 → 5.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elasticsearch/transport/client.rb +3 -0
- data/lib/elasticsearch/transport/transport/connections/connection.rb +1 -1
- data/lib/elasticsearch/transport/transport/http/curb.rb +3 -0
- data/lib/elasticsearch/transport/version.rb +1 -1
- data/test/integration/client_test.rb +2 -2
- data/test/integration/transport_test.rb +2 -2
- data/test/unit/client_test.rb +8 -0
- data/test/unit/connection_test.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9141220bdecbb5cd5fe9eef893010d24419a62a6
|
4
|
+
data.tar.gz: e2a2ad61469a9398e749b4004909ec2234360262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47916a61140347aba5eb71728587d4c611f0219e8f03d3584405fde93d10fe991f38652b5125e073ad37f16cedd72fe452faea82197f892b539c95809db5cf74
|
7
|
+
data.tar.gz: 9130c01c4a9d7687f42fa57848c3dac0ae7382972e1c68776319c829b079307ccda469846f6231e2e64c783225c43a75386d35b6de8f3d5614516266d24e80c8
|
@@ -39,7 +39,7 @@ module Elasticsearch
|
|
39
39
|
#
|
40
40
|
def full_url(path, params={})
|
41
41
|
url = "#{host[:protocol]}://"
|
42
|
-
url += "#{host[:user]}:#{host[:password]}@" if host[:user]
|
42
|
+
url += "#{CGI.escape(host[:user])}:#{CGI.escape(host[:password])}@" if host[:user]
|
43
43
|
url += "#{host[:host]}:#{host[:port]}"
|
44
44
|
url += "#{host[:path]}" if host[:path]
|
45
45
|
url += "/#{full_path(path, params)}"
|
@@ -21,7 +21,10 @@ module Elasticsearch
|
|
21
21
|
|
22
22
|
case method
|
23
23
|
when 'HEAD'
|
24
|
+
connection.connection.set :nobody, true
|
24
25
|
when 'GET', 'POST', 'PUT', 'DELETE'
|
26
|
+
connection.connection.set :nobody, false
|
27
|
+
|
25
28
|
connection.connection.put_data = __convert_to_json(body) if body
|
26
29
|
else raise ArgumentError, "Unsupported HTTP method: #{method}"
|
27
30
|
end
|
@@ -2,11 +2,11 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::IntegrationTestCase
|
4
4
|
startup do
|
5
|
-
Elasticsearch::Extensions::Test::Cluster.start(
|
5
|
+
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 2) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 2)
|
6
6
|
end
|
7
7
|
|
8
8
|
shutdown do
|
9
|
-
Elasticsearch::Extensions::Test::Cluster.stop if ENV['SERVER'] and Elasticsearch::Extensions::Test::Cluster.running?
|
9
|
+
Elasticsearch::Extensions::Test::Cluster.stop(number_of_nodes: 2) if ENV['SERVER'] and Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 2)
|
10
10
|
end
|
11
11
|
|
12
12
|
context "Elasticsearch client" do
|
@@ -2,11 +2,11 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::IntegrationTestCase
|
4
4
|
startup do
|
5
|
-
Elasticsearch::Extensions::Test::Cluster.start(
|
5
|
+
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 2) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 2)
|
6
6
|
end
|
7
7
|
|
8
8
|
shutdown do
|
9
|
-
Elasticsearch::Extensions::Test::Cluster.stop if ENV['SERVER'] and Elasticsearch::Extensions::Test::Cluster.running?
|
9
|
+
Elasticsearch::Extensions::Test::Cluster.stop(number_of_nodes: 2) if ENV['SERVER'] and Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 2)
|
10
10
|
end
|
11
11
|
|
12
12
|
context "Transport" do
|
data/test/unit/client_test.rb
CHANGED
@@ -228,6 +228,14 @@ class Elasticsearch::Transport::ClientTest < Test::Unit::TestCase
|
|
228
228
|
assert_equal 'bar', hosts[1][:host]
|
229
229
|
end
|
230
230
|
|
231
|
+
should "remove trailing slash from URL path" do
|
232
|
+
hosts = @client.__extract_hosts 'http://myhost/'
|
233
|
+
assert_equal '', hosts[0][:path]
|
234
|
+
|
235
|
+
hosts = @client.__extract_hosts 'http://myhost/foo/bar/'
|
236
|
+
assert_equal '/foo/bar', hosts[0][:path]
|
237
|
+
end
|
238
|
+
|
231
239
|
should "raise error for incompatible argument" do
|
232
240
|
assert_raise ArgumentError do
|
233
241
|
@client.__extract_hosts 123
|
@@ -30,6 +30,11 @@ class Elasticsearch::Transport::Transport::Connections::ConnectionTest < Test::U
|
|
30
30
|
assert_equal 'http://U:P@localhost:9200/_search?foo=bar', c.full_url('_search', {:foo => 'bar'})
|
31
31
|
end
|
32
32
|
|
33
|
+
should "return full url with escaped credentials" do
|
34
|
+
c = Connection.new :host => { :protocol => 'http', :user => 'U$$$', :password => 'P^^^', :host => 'localhost', :port => '9200' }
|
35
|
+
assert_equal 'http://U%24%24%24:P%5E%5E%5E@localhost:9200/_search?foo=bar', c.full_url('_search', {:foo => 'bar'})
|
36
|
+
end
|
37
|
+
|
33
38
|
should "return full url with path" do
|
34
39
|
c = Connection.new :host => { :protocol => 'http', :host => 'localhost', :port => '9200', :path => '/foo' }
|
35
40
|
assert_equal 'http://localhost:9200/foo/_search?foo=bar', c.full_url('_search', {:foo => 'bar'})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -415,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
415
415
|
version: '0'
|
416
416
|
requirements: []
|
417
417
|
rubyforge_project:
|
418
|
-
rubygems_version: 2.6.
|
418
|
+
rubygems_version: 2.6.11
|
419
419
|
signing_key:
|
420
420
|
specification_version: 4
|
421
421
|
summary: Ruby client for Elasticsearch.
|