manticore 0.3.3-java → 0.3.4-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 +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +9 -1
- data/lib/manticore/client.rb +16 -9
- data/lib/manticore/response.rb +0 -0
- data/lib/manticore/version.rb +1 -1
- data/spec/manticore/client_spec.rb +22 -0
- data/spec/ssl/ca_cert.pem +29 -31
- metadata +15 -15
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353676ba5c5c9ff2a01a4df74c63e059abc55b37
|
4
|
+
data.tar.gz: f8ffecdb2d6f8bce9c03a2f8ebeb518329a579a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a0ae79dee6fc7f0420b1ad3a614c91aea0e0abd12d9a0a32c4833432e2ee0fe7ac4f2bc9e3386a9f7ca9f54f110c75fa61cddc2ca6926e7ca710cd5e341bc21
|
7
|
+
data.tar.gz: 2eef5cf9942d6fb7d0070bef2db25de3d24a9184d6a6e36fd5b073f5a6decff662ab37b9e83a5144f0dca4601d397d698d24cf44b5674bd0c8f4841903c9ddd2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## v0.3
|
2
|
-
### v0.3.
|
2
|
+
### v0.3.5 (pending)
|
3
|
+
|
4
|
+
### v0.3.4
|
5
|
+
|
6
|
+
* Fixed an issue that caused the presence of request-specific options (ie, max_redirects) to cause the request to use a
|
7
|
+
default settings config, rather than respecting the client options. (thanks @zanker)
|
8
|
+
* Turn off connection state tracking by default; this enables connections to be shared across threads, and shouldn't be an
|
9
|
+
issue for most installs. If you need it on, pass :ssl => {:track_state => true} when instantiating a client. (thanks @zanker)
|
10
|
+
|
3
11
|
### v0.3.3
|
4
12
|
|
5
13
|
* Update to HttpCommons 4.3.6
|
data/lib/manticore/client.rb
CHANGED
@@ -138,9 +138,12 @@ module Manticore
|
|
138
138
|
# @option options [String] ssl[:keystore] (nil) Path to a custom key store to use for client certificate authentication
|
139
139
|
# @option options [String] ssl[:keystore_password] (nil) Password used for decrypting the client auth key store
|
140
140
|
# @option options [String] ssl[:keystore_type] (nil) Format of the key store, ie "JKS" or "PKCS12". If left nil, the type will be inferred from the keystore filename.
|
141
|
+
# @option options [boolean] ssl[:track_state] (false) Turn on or off connection state tracking. This helps prevent SSL information from leaking across threads, but means that connections
|
142
|
+
# can't be shared across those threads. This should generally be left off unless you know what you're doing.
|
141
143
|
def initialize(options = {})
|
142
144
|
builder = client_builder
|
143
145
|
builder.set_user_agent options.fetch(:user_agent, "Manticore #{VERSION}")
|
146
|
+
@options = options
|
144
147
|
@use_cookies = options.fetch(:cookies, false)
|
145
148
|
builder.disable_cookie_management unless @use_cookies
|
146
149
|
builder.disable_content_compression if options.fetch(:compression, true) == false
|
@@ -160,9 +163,11 @@ module Manticore
|
|
160
163
|
end
|
161
164
|
end
|
162
165
|
|
163
|
-
#
|
164
|
-
#
|
165
|
-
#
|
166
|
+
# http://hc.apache.org/httpcomponents-client-ga/tutorial/html/advanced.html#stateful_conn
|
167
|
+
# By default this is used to prevent different contexts from accessing SSL data
|
168
|
+
# Since we're running this for JRuby which does not have context separation within the JVM
|
169
|
+
# We can disable this for connection reuse.
|
170
|
+
builder.disable_connection_state unless options.fetch(:ssl, {}).fetch(:track_state, false)
|
166
171
|
|
167
172
|
keepalive = options.fetch(:keepalive, true)
|
168
173
|
if keepalive == false
|
@@ -420,12 +425,14 @@ module Manticore
|
|
420
425
|
|
421
426
|
if options.key?(:proxy) || options.key?(:connect_timeout) || options.key?(:socket_timeout) || options.key?(:max_redirects) || options.key?(:follow_redirects)
|
422
427
|
config = RequestConfig.custom()
|
423
|
-
|
424
|
-
|
425
|
-
config.
|
426
|
-
config.set_max_redirects
|
427
|
-
config.set_redirects_enabled !!
|
428
|
-
config.
|
428
|
+
req_options = @options.merge(options)
|
429
|
+
|
430
|
+
config.set_proxy get_proxy_host(req_options[:proxy]) if req_options[:proxy]
|
431
|
+
config.set_max_redirects req_options[:max_redirects] if req_options[:max_redirects]
|
432
|
+
config.set_redirects_enabled !!req_options[:follow_redirects] if req_options.fetch(:follow_redirects, nil) != nil
|
433
|
+
config.set_connect_timeout req_options[:connect_timeout] * 1000 if req_options[:connect_timeout]
|
434
|
+
config.set_socket_timeout req_options[:socket_timeout] * 1000 if req_options[:socket_timeout]
|
435
|
+
config.set_connection_request_timeout req_options[:request_timeout] * 1000 if req_options[:request_timeout]
|
429
436
|
req.set_config config.build
|
430
437
|
end
|
431
438
|
|
data/lib/manticore/response.rb
CHANGED
File without changes
|
data/lib/manticore/version.rb
CHANGED
@@ -42,6 +42,16 @@ describe Manticore::Client do
|
|
42
42
|
j["uri"]["port"].should == 55441
|
43
43
|
end
|
44
44
|
|
45
|
+
describe "with a custom user agent" do
|
46
|
+
let(:client) { Manticore::Client.new user_agent: "test-agent/1.0" }
|
47
|
+
|
48
|
+
it "should use the specified UA" do
|
49
|
+
response = client.get(local_server("/"))
|
50
|
+
json = JSON.load(response.body)
|
51
|
+
expect(json["headers"]["User-Agent"]).to eq "test-agent/1.0"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
45
55
|
describe "ignore_ssl_validation (deprecated option)" do
|
46
56
|
context "when on" do
|
47
57
|
let(:client) { Manticore::Client.new ssl: {verify: false} }
|
@@ -559,6 +569,18 @@ describe Manticore::Client do
|
|
559
569
|
end
|
560
570
|
end
|
561
571
|
|
572
|
+
describe "with connection timeouts" do
|
573
|
+
let(:client) { Manticore::Client.new request_timeout: 1, connect_timeout: 1, socket_timeout: 1 }
|
574
|
+
|
575
|
+
it "should time out" do
|
576
|
+
expect { client.get(local_server "/?sleep=2").body }.to raise_exception(Manticore::Timeout)
|
577
|
+
end
|
578
|
+
|
579
|
+
it "should time out when custom request options are passed" do
|
580
|
+
expect { client.get(local_server("/?sleep=2"), max_redirects: 5).body }.to raise_exception(Manticore::Timeout)
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
562
584
|
def get_connection(client, uri, &block)
|
563
585
|
java_import "java.util.concurrent.TimeUnit"
|
564
586
|
host = URI.parse(uri).host
|
data/spec/ssl/ca_cert.pem
CHANGED
@@ -1,33 +1,31 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
8s25QyDvJfUy5n+/0sxPBSR7Uk9yn9se3Q6zKF4pMcxUyC2yqgZZv5Et41dkJbac
|
32
|
-
wuhTyH5RfnYu
|
2
|
+
MIIFPjCCAyYCCQCQsu6LeOWnuzANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQGEwJV
|
3
|
+
UzELMAkGA1UECAwCTUQxEjAQBgNVBAcMCUJhbHRpbW9yZTEQMA4GA1UEAwwHVGVz
|
4
|
+
dCBDQTEfMB0GCSqGSIb3DQEJARYQdGVzdEBleGFtcGxlLmNvbTAeFw0xNTAxMDcx
|
5
|
+
NzM3MDdaFw0yODA5MTUxNzM3MDdaMGExCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJN
|
6
|
+
RDESMBAGA1UEBwwJQmFsdGltb3JlMRAwDgYDVQQDDAdUZXN0IENBMR8wHQYJKoZI
|
7
|
+
hvcNAQkBFhB0ZXN0QGV4YW1wbGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAO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olhjzGkwjZ5KoJVmXTQlTzz2PJ
|
23
|
+
mVeIQXlceawj25inhjdvjFWMaO1csm5ZNqIBvLgN45gKxcnDjUbUyglRRa0Dxvut
|
24
|
+
T94HbFONYHWMTDWO5ElGgjjjdwCAiyKuAk/Lv5ZJ8dw8ByPLzsjM76lbzlXGDGsx
|
25
|
+
/ay4PuBCOMKOul4yyb8WMFcsIzk/f/mUhU68gTesMYX0mNYqjDvifA8Ws7So+yD+
|
26
|
+
oMAwMabkn11p5UwPLpszr7cqfmYTsxcHQUKFYPM3jySxaqOU1mwL4d/FshrcR1s2
|
27
|
+
doen2Dq2VzJFxJqsQVK7uvEz847Av3JRUDCbjx7rYc9DfuY6anZ1/tv7YqPGxiXd
|
28
|
+
LznEPNy9/9p5gGtlj6bqo8l4Kf+puvpkX3qICelO3P9Unzky+tNrkY7i2rgK9Vyh
|
29
|
+
X6EOcJ8K53Y9AHOvKElq/UszMOjkZbpGo/qhZkYPGqaD8yM35MNrQXBonk/zH6cA
|
30
|
+
xA4=
|
33
31
|
-----END CERTIFICATE-----
|
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.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Chris Heald
|
@@ -30,50 +30,50 @@ cert_chain:
|
|
30
30
|
E7PWS50D9moUJ6xWcemf0qKYC87qBFh0ng73awjG9uf+13lMslqJRMtek8C92cvh
|
31
31
|
+R9zgQlbeNjy9O1i
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name: addressable
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '2.3'
|
42
36
|
requirement: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
38
|
- - ~>
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: '2.3'
|
41
|
+
name: addressable
|
47
42
|
prerelease: false
|
48
43
|
type: :runtime
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: bundler
|
51
44
|
version_requirements: !ruby/object:Gem::Requirement
|
52
45
|
requirements:
|
53
46
|
- - ~>
|
54
47
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
48
|
+
version: '2.3'
|
49
|
+
- !ruby/object:Gem::Dependency
|
56
50
|
requirement: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - ~>
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '1.3'
|
55
|
+
name: bundler
|
61
56
|
prerelease: false
|
62
57
|
type: :development
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: rake
|
65
58
|
version_requirements: !ruby/object:Gem::Requirement
|
66
59
|
requirements:
|
67
|
-
- -
|
60
|
+
- - ~>
|
68
61
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
62
|
+
version: '1.3'
|
63
|
+
- !ruby/object:Gem::Dependency
|
70
64
|
requirement: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
66
|
- - '>='
|
73
67
|
- !ruby/object:Gem::Version
|
74
68
|
version: '0'
|
69
|
+
name: rake
|
75
70
|
prerelease: false
|
76
71
|
type: :development
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
77
|
description: Manticore is an HTTP client built on the Apache HttpCore components
|
78
78
|
email:
|
79
79
|
- cheald@mashable.com
|
metadata.gz.sig
CHANGED
Binary file
|