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 +4 -4
- checksums.yaml.gz.sig +2 -1
- data/.travis.yml +4 -0
- data/CHANGELOG.md +8 -1
- data/Gemfile +2 -1
- data/lib/jar/{httpclient-4.3.2-patched.jar → httpclient-4.3.6.jar} +0 -0
- data/lib/jar/{httpcore-4.3.1.jar → httpcore-4.3.3.jar} +0 -0
- data/lib/jar/{httpmime-4.3.2.jar → httpmime-4.3.6.jar} +0 -0
- data/lib/manticore/client.rb +1 -1
- data/lib/manticore/response.rb +14 -5
- data/lib/manticore/version.rb +1 -1
- data/lib/manticore.rb +1 -1
- data/spec/manticore/client_spec.rb +20 -11
- data/spec/manticore/cookie_spec.rb +4 -4
- data/spec/manticore/response_spec.rb +9 -1
- data/spec/manticore/stubbed_response_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +5 -6
- metadata.gz.sig +0 -0
- data/lib/jar/lazy_decompressing_stream.patch +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d1a619a796954b17b56a23381741f57e603d174
|
4
|
+
data.tar.gz: bf682e7d96bcb816abf0dacdaa6bb0e6760777d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb94165a8770dddf5dc1c4c7972433ea12934402a83284fa3890fbf058924dc67205c6d3bed3844cd7a2437c2c2825c90a6bb339935249c9531c272bf7e79f2
|
7
|
+
data.tar.gz: 300152b1d96c32d4edbb7df6dcff295c780ebc2d568dbc7562e863cf8da6840fd6ab33e8080a01f0711fb3798d9955b75e25fa8159da846b51edf5cf05233c7b
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
I��HO�q���$G��z��^K���v�*N����HX?��e�9�0�+[;݃���Q��f��D�����c���h�]7;�M�D���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
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## v0.3
|
2
|
-
### v0.3.
|
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
Binary file
|
Binary file
|
Binary file
|
data/lib/manticore/client.rb
CHANGED
@@ -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)
|
data/lib/manticore/response.rb
CHANGED
@@ -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.
|
51
|
+
ex = Manticore::Timeout.new(e.cause || e.message)
|
52
52
|
rescue Java::JavaNet::SocketException => e
|
53
|
-
ex = Manticore::SocketException.new(e.
|
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.
|
56
|
+
ex = Manticore::ClientProtocolException.new(e.cause || e.message)
|
57
57
|
rescue Java::JavaNet::UnknownHostException => e
|
58
|
-
ex = Manticore::ResolutionFailure.new(e.
|
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
|
data/lib/manticore/version.rb
CHANGED
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.
|
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
|
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
|
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
|
-
|
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
|
-
|
148
|
+
skip
|
140
149
|
end
|
141
150
|
|
142
151
|
describe ":protocols" do
|
143
|
-
|
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
|
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
|
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
|
-
|
472
|
+
skip
|
464
473
|
response = client.get(url).call
|
465
474
|
get_connection(client, url) do |conn|
|
466
|
-
conn.is_open.should
|
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
|
-
|
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
|
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
|
25
|
-
its(:persistent?) { should
|
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
|
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
|
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
|
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
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.
|
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-
|
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.
|
97
|
-
- lib/jar/httpcore-4.3.
|
98
|
-
- lib/jar/httpmime-4.3.
|
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();
|