manticore 0.3.2-java → 0.3.3-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb2cec897fad8daff54f1823bb5a01f33da18d2e
4
- data.tar.gz: 4ee22665fa497aceaa9b5df01c79264ef47a8667
3
+ metadata.gz: 6d1a619a796954b17b56a23381741f57e603d174
4
+ data.tar.gz: bf682e7d96bcb816abf0dacdaa6bb0e6760777d6
5
5
  SHA512:
6
- metadata.gz: 2be50f1dff4384bd95f61d6d5328aa4690461436c9d57dadae905fba897602b1c470d41763edca4955ea1d45f96f48ef80a52eccab4b3679e26bda1317cd78d6
7
- data.tar.gz: 174cae4b6fef3465b339bbd4e831eed8aeb40284459102fe68fa32b3412b04460b3cbc8c649267339e50830263d0a894760fe14c55ee6c778c9370e021a6db45
6
+ metadata.gz: 2fb94165a8770dddf5dc1c4c7972433ea12934402a83284fa3890fbf058924dc67205c6d3bed3844cd7a2437c2c2825c90a6bb339935249c9531c272bf7e79f2
7
+ data.tar.gz: 300152b1d96c32d4edbb7df6dcff295c780ebc2d568dbc7562e863cf8da6840fd6ab33e8080a01f0711fb3798d9955b75e25fa8159da846b51edf5cf05233c7b
checksums.yaml.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ��.ѝ*�_�$٤����vQHId9�,tU.l��eS Q���(���f5`��m��;E {�=�3
1
+ I��HO� q���$G��z��^K���v�*N����HX?��e�9�0�+[;݃���Q��f D�����c���h�]7;�MD���3�
2
+ [`J��"��m�����g��8\��d]�B�Y'�˝:�bk��*��D��h(���v2����[��F�~��I�B�s!A�?�� ��ťf�֝�{�\��>!�1C2m4S�լ�~�{���\�T��\'q�SS��$O��8�痸�p) ��xo
data/.travis.yml CHANGED
@@ -1,3 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - jruby
4
+ jdk:
5
+ - oraclejdk8
6
+ - oraclejdk7
7
+ - openjdk7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## v0.3
2
- ### v0.3.3 (pending)
2
+ ### v0.3.4 (pending)
3
+ ### v0.3.3
4
+
5
+ * Update to HttpCommons 4.3.6
6
+ * Added Response#message (thanks @zanker)
7
+ * Fix issues with HTTP error messages that didn't contain a useful message
8
+ * Fixed an issue that would prevent the :protocols and :cipher_suites options from working
9
+
3
10
  ### v0.3.2
4
11
  * :ignore_ssl_validation is now deprecated. It has been replaced with :ssl, which takes a hash of options. These include:
5
12
 
data/Gemfile CHANGED
@@ -4,7 +4,8 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem "net-http-server", "~> 0.2"
7
- gem "rspec", "~> 2.14"
7
+ gem "rspec", "~> 2.0"
8
+ gem "rspec-its"
8
9
  gem "httpclient", "~> 2.3"
9
10
  gem "rack", "~> 1.5"
10
11
  gem "rake-compiler"
@@ -523,7 +523,7 @@ module Manticore
523
523
  context.load_key_material(key_store, ssl_options.fetch(:keystore_password, nil).to_java.toCharArray)
524
524
  end
525
525
 
526
- SSLConnectionSocketFactory.new context.build, ssl_options[:protocols], ssl_options[:cipher_suites], verifier
526
+ SSLConnectionSocketFactory.new context.build, ssl_options[:protocols].to_java(:string), ssl_options[:cipher_suites].to_java(:string), verifier
527
527
  end
528
528
 
529
529
  def get_trust_store(options)
@@ -48,14 +48,14 @@ module Manticore
48
48
  execute_complete
49
49
  return self
50
50
  rescue Java::JavaNet::SocketTimeoutException, Java::OrgApacheHttpConn::ConnectTimeoutException => e
51
- ex = Manticore::Timeout.new(e.get_cause)
51
+ ex = Manticore::Timeout.new(e.cause || e.message)
52
52
  rescue Java::JavaNet::SocketException => e
53
- ex = Manticore::SocketException.new(e.get_cause)
53
+ ex = Manticore::SocketException.new(e.cause || e.message)
54
54
  rescue Java::OrgApacheHttpClient::ClientProtocolException, Java::JavaxNetSsl::SSLHandshakeException, Java::OrgApacheHttpConn::HttpHostConnectException,
55
55
  Java::OrgApacheHttp::NoHttpResponseException, Java::OrgApacheHttp::ConnectionClosedException => e
56
- ex = Manticore::ClientProtocolException.new(e.get_cause)
56
+ ex = Manticore::ClientProtocolException.new(e.cause || e.message)
57
57
  rescue Java::JavaNet::UnknownHostException => e
58
- ex = Manticore::ResolutionFailure.new(e.get_cause)
58
+ ex = Manticore::ResolutionFailure.new(e.cause || e.message)
59
59
  end
60
60
  @exception = ex
61
61
  @handlers[:failure].call ex
@@ -128,6 +128,14 @@ module Manticore
128
128
  @code
129
129
  end
130
130
 
131
+ # Return the response text for a request as a string (Not Found, Ok, Bad Request, etc). Will call the request if it has not been called yet.
132
+ #
133
+ # @return [String] The response code text
134
+ def message
135
+ call_once
136
+ @message
137
+ end
138
+
131
139
  # Returns the length of the response body. Returns -1 if content-length is not present in the response.
132
140
  #
133
141
  # @return [Integer]
@@ -206,6 +214,7 @@ module Manticore
206
214
  def handleResponse(response)
207
215
  @response = response
208
216
  @code = response.get_status_line.get_status_code
217
+ @message = response.get_status_line.get_reason_phrase
209
218
  @headers = Hash[* response.get_all_headers.flat_map {|h| [h.get_name.downcase, h.get_value]} ]
210
219
  @callback_result = @handlers[:success].call(self)
211
220
  nil
@@ -220,4 +229,4 @@ module Manticore
220
229
  @handlers[:complete].each &:call
221
230
  end
222
231
  end
223
- end
232
+ end
@@ -1,3 +1,3 @@
1
1
  module Manticore
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/manticore.rb CHANGED
@@ -3,7 +3,7 @@ require 'uri'
3
3
  require 'cgi'
4
4
  require 'cgi/cookie'
5
5
 
6
- jars = ["httpcore-4.3.1", "httpclient-4.3.2-patched", "commons-logging-1.1.3", "commons-codec-1.6.jar", "httpmime-4.3.2.jar"]
6
+ jars = ["httpcore-4.3.3", "httpclient-4.3.6", "commons-logging-1.1.3", "commons-codec-1.6.jar", "httpmime-4.3.6.jar"]
7
7
  jars.each do |jar|
8
8
  begin
9
9
  require_relative "./jar/#{jar}"
@@ -44,7 +44,7 @@ describe Manticore::Client do
44
44
 
45
45
  describe "ignore_ssl_validation (deprecated option)" do
46
46
  context "when on" do
47
- let(:client) { Manticore::Client.new ignore_ssl_validation: true }
47
+ let(:client) { Manticore::Client.new ssl: {verify: false} }
48
48
 
49
49
  it "should not break on SSL validation errors" do
50
50
  expect { client.get("https://localhost:55444/").body }.to_not raise_exception
@@ -52,7 +52,7 @@ describe Manticore::Client do
52
52
  end
53
53
 
54
54
  context "when off" do
55
- let(:client) { Manticore::Client.new ignore_ssl_validation: false }
55
+ let(:client) { Manticore::Client.new ssl: {verify: true} }
56
56
 
57
57
  it "should break on SSL validation errors" do
58
58
  expect { client.get("https://localhost:55444/").call }.to raise_exception(Manticore::ClientProtocolException)
@@ -86,6 +86,14 @@ describe Manticore::Client do
86
86
  end
87
87
  end
88
88
 
89
+ context "when the client specifies a protocol list" do
90
+ let(:client) { Manticore::Client.new :ssl => {verify: :strict, truststore: File.expand_path("../../ssl/test_truststore", __FILE__), truststore_password: "test123", protocols: ["TLSv1", "TLSv1.1", "TLSv1.2"]} }
91
+
92
+ it "should verify the request and succeed" do
93
+ expect { client.get("https://localhost:55444/").body }.to_not raise_exception
94
+ end
95
+ end
96
+
89
97
  context 'when on and custom trust store is given with the wrong password' do
90
98
  let(:client) { Manticore::Client.new :ssl => {verify: :strict, truststore: File.expand_path("../../ssl/test_truststore", __FILE__), truststore_password: "wrongpass"} }
91
99
 
@@ -129,18 +137,19 @@ describe Manticore::Client do
129
137
  }
130
138
 
131
139
  it "should fail the request" do
132
- expect { client.get("https://localhost:55445/").body }.to raise_exception(Manticore::ClientProtocolException)
140
+ # oraclejdk7 throws a SocketException here, oraclejdk8/openjdk7 throw ClientProtocolException
141
+ expect { client.get("https://localhost:55445/").body }.to raise_exception(Manticore::ManticoreException)
133
142
  end
134
143
  end
135
144
  end
136
145
  end
137
146
 
138
147
  describe ":cipher_suites" do
139
- pending
148
+ skip
140
149
  end
141
150
 
142
151
  describe ":protocols" do
143
- pending
152
+ skip
144
153
  end
145
154
  end
146
155
 
@@ -417,7 +426,7 @@ describe Manticore::Client do
417
426
  client.async.get("http://google.com").on_success {|r| ran = true }
418
427
  client.clear_pending
419
428
  client.execute!.should be_empty
420
- ran.should be_false
429
+ ran.should be false
421
430
  end
422
431
  end
423
432
 
@@ -435,7 +444,7 @@ describe Manticore::Client do
435
444
  end
436
445
  }
437
446
 
438
- called.should be_true
447
+ called.should be true
439
448
 
440
449
  client.clear_stubs!
441
450
  client.get(local_server) do |response|
@@ -460,10 +469,10 @@ describe Manticore::Client do
460
469
  let(:client) { Manticore::Client.new keepalive: true, pool_max: 1 }
461
470
 
462
471
  it "should keep the connection open after a request" do
463
- pending
472
+ skip
464
473
  response = client.get(url).call
465
474
  get_connection(client, url) do |conn|
466
- conn.is_open.should be_true
475
+ conn.is_open.should be true
467
476
  end
468
477
  end
469
478
  end
@@ -472,11 +481,11 @@ describe Manticore::Client do
472
481
  let(:client) { Manticore::Client.new keepalive: false, pool_max: 1 }
473
482
 
474
483
  it "should close the connection after a request" do
475
- pending
484
+ skip
476
485
  response = client.get(url).call
477
486
  puts `netstat -apn`
478
487
  # get_connection(client, url) do |conn|
479
- # conn.is_open.should be_false
488
+ # conn.is_open.should be false
480
489
  # end
481
490
  end
482
491
  end
@@ -21,16 +21,16 @@ describe Manticore::Cookie do
21
21
  Manticore::Cookie.new({name: "foo", value: "bar"}.merge(opts))
22
22
  }
23
23
 
24
- its(:secure?) { should be_false }
25
- its(:persistent?) { should be_false }
24
+ its(:secure?) { should be nil }
25
+ its(:persistent?) { should be nil }
26
26
 
27
27
  context "created as secure" do
28
28
  let(:opts) {{ secure: true }}
29
- its(:secure?) { should be_true }
29
+ its(:secure?) { should be true }
30
30
  end
31
31
 
32
32
  context "created as persistent" do
33
33
  let(:opts) {{ persistent: true }}
34
- its(:persistent?) { should be_true }
34
+ its(:persistent?) { should be true }
35
35
  end
36
36
  end
@@ -12,6 +12,14 @@ describe Manticore::Response do
12
12
  subject.body.should match "Manticore"
13
13
  end
14
14
 
15
+ it "should read the status code" do
16
+ subject.code.should eq 200
17
+ end
18
+
19
+ it "should read the status text" do
20
+ subject.message.should match "OK"
21
+ end
22
+
15
23
  context "when the client is invoked with a block" do
16
24
  it "should allow reading the body from a block" do
17
25
  response = client.get(local_server) do |response|
@@ -34,4 +42,4 @@ describe Manticore::Response do
34
42
  expect { client.get(local_server).call rescue nil }.to_not change { client.pool_stats[:available] }
35
43
  end
36
44
  end
37
- end
45
+ end
@@ -32,7 +32,7 @@ describe Manticore::StubbedResponse do
32
32
  it "should call on_success handlers" do
33
33
  called = false
34
34
  Manticore::StubbedResponse.stub.on_success {|resp| called = true }.call
35
- called.should be_true
35
+ called.should be true
36
36
  end
37
37
 
38
38
  it "should persist cookies passed in set-cookie" do
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ require 'rack'
7
7
  require 'webrick'
8
8
  require 'webrick/https'
9
9
  require 'openssl'
10
+ require 'rspec/its'
10
11
 
11
12
  PORT = 55441
12
13
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manticore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: java
6
6
  authors:
7
7
  - Chris Heald
@@ -30,7 +30,7 @@ cert_chain:
30
30
  E7PWS50D9moUJ6xWcemf0qKYC87qBFh0ng73awjG9uf+13lMslqJRMtek8C92cvh
31
31
  +R9zgQlbeNjy9O1i
32
32
  -----END CERTIFICATE-----
33
- date: 2014-12-11 00:00:00.000000000 Z
33
+ date: 2014-12-14 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: addressable
@@ -93,10 +93,9 @@ files:
93
93
  - gem-public_cert.pem
94
94
  - lib/jar/commons-codec-1.6.jar
95
95
  - lib/jar/commons-logging-1.1.3.jar
96
- - lib/jar/httpclient-4.3.2-patched.jar
97
- - lib/jar/httpcore-4.3.1.jar
98
- - lib/jar/httpmime-4.3.2.jar
99
- - lib/jar/lazy_decompressing_stream.patch
96
+ - lib/jar/httpclient-4.3.6.jar
97
+ - lib/jar/httpcore-4.3.3.jar
98
+ - lib/jar/httpmime-4.3.6.jar
100
99
  - lib/jar/manticore-ext.jar
101
100
  - lib/manticore.rb
102
101
  - lib/manticore/client.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,17 +0,0 @@
1
- diff --git a/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java b/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
2
- index 26e4981..ef07caf 100644
3
- --- a/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
4
- +++ b/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
5
- @@ -57,6 +57,12 @@ class LazyDecompressingInputStream extends InputStream {
6
- }
7
-
8
- @Override
9
- + public int read(final byte[] b, final int off, final int len) throws IOException {
10
- + initWrapper();
11
- + return wrapperStream.read(b, off, len);
12
- + }
13
- +
14
- + @Override
15
- public int available() throws IOException {
16
- initWrapper();
17
- return wrapperStream.available();