scout 5.7.1 → 5.7.2.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.markdown +5 -0
- data/lib/scout/command/run.rb +1 -1
- data/lib/scout/server.rb +2 -1
- data/lib/scout/streamer.rb +3 -2
- data/lib/scout/streamer_daemon.rb +4 -4
- data/lib/scout/version.rb +1 -1
- data/test/scout_test.rb +7 -8
- data/vendor/httpclient/README.txt +759 -0
- data/vendor/httpclient/bin/httpclient +65 -0
- data/vendor/httpclient/lib/hexdump.rb +50 -0
- data/vendor/httpclient/lib/http-access2.rb +55 -0
- data/vendor/httpclient/lib/http-access2/cookie.rb +1 -0
- data/vendor/httpclient/lib/http-access2/http.rb +1 -0
- data/vendor/httpclient/lib/httpclient.rb +1156 -0
- data/vendor/httpclient/lib/httpclient/auth.rb +899 -0
- data/vendor/httpclient/lib/httpclient/cacert.p7s +1912 -0
- data/vendor/httpclient/lib/httpclient/connection.rb +88 -0
- data/vendor/httpclient/lib/httpclient/cookie.rb +438 -0
- data/vendor/httpclient/lib/httpclient/http.rb +1046 -0
- data/vendor/httpclient/lib/httpclient/include_client.rb +83 -0
- data/vendor/httpclient/lib/httpclient/session.rb +1025 -0
- data/vendor/httpclient/lib/httpclient/ssl_config.rb +403 -0
- data/vendor/httpclient/lib/httpclient/timeout.rb +140 -0
- data/vendor/httpclient/lib/httpclient/util.rb +178 -0
- data/vendor/httpclient/lib/httpclient/version.rb +3 -0
- data/vendor/httpclient/lib/oauthclient.rb +110 -0
- data/vendor/httpclient/sample/async.rb +8 -0
- data/vendor/httpclient/sample/auth.rb +11 -0
- data/vendor/httpclient/sample/cookie.rb +18 -0
- data/vendor/httpclient/sample/dav.rb +103 -0
- data/vendor/httpclient/sample/howto.rb +49 -0
- data/vendor/httpclient/sample/oauth_buzz.rb +57 -0
- data/vendor/httpclient/sample/oauth_friendfeed.rb +59 -0
- data/vendor/httpclient/sample/oauth_salesforce_10.rb +63 -0
- data/vendor/httpclient/sample/oauth_twitter.rb +61 -0
- data/vendor/httpclient/sample/ssl/0cert.pem +22 -0
- data/vendor/httpclient/sample/ssl/0key.pem +30 -0
- data/vendor/httpclient/sample/ssl/1000cert.pem +19 -0
- data/vendor/httpclient/sample/ssl/1000key.pem +18 -0
- data/vendor/httpclient/sample/ssl/htdocs/index.html +10 -0
- data/vendor/httpclient/sample/ssl/ssl_client.rb +22 -0
- data/vendor/httpclient/sample/ssl/webrick_httpsd.rb +29 -0
- data/vendor/httpclient/sample/stream.rb +21 -0
- data/vendor/httpclient/sample/thread.rb +27 -0
- data/vendor/httpclient/sample/wcat.rb +21 -0
- data/vendor/httpclient/test/ca-chain.cert +44 -0
- data/vendor/httpclient/test/ca.cert +23 -0
- data/vendor/httpclient/test/client.cert +19 -0
- data/vendor/httpclient/test/client.key +15 -0
- data/vendor/httpclient/test/helper.rb +129 -0
- data/vendor/httpclient/test/htdigest +1 -0
- data/vendor/httpclient/test/htpasswd +2 -0
- data/vendor/httpclient/test/runner.rb +2 -0
- data/vendor/httpclient/test/server.cert +19 -0
- data/vendor/httpclient/test/server.key +15 -0
- data/vendor/httpclient/test/sslsvr.rb +65 -0
- data/vendor/httpclient/test/subca.cert +21 -0
- data/vendor/httpclient/test/test_auth.rb +321 -0
- data/vendor/httpclient/test/test_cookie.rb +391 -0
- data/vendor/httpclient/test/test_hexdump.rb +14 -0
- data/vendor/httpclient/test/test_http-access2.rb +507 -0
- data/vendor/httpclient/test/test_httpclient.rb +1783 -0
- data/vendor/httpclient/test/test_include_client.rb +52 -0
- data/vendor/httpclient/test/test_ssl.rb +235 -0
- data/vendor/multi_json/.document +5 -0
- data/vendor/multi_json/.rspec +3 -0
- data/vendor/multi_json/.travis.yml +11 -0
- data/vendor/multi_json/.yardopts +6 -0
- data/vendor/multi_json/CHANGELOG.md +169 -0
- data/vendor/multi_json/CONTRIBUTING.md +46 -0
- data/vendor/multi_json/Gemfile +31 -0
- data/vendor/multi_json/LICENSE.md +20 -0
- data/vendor/multi_json/README.md +109 -0
- data/vendor/multi_json/Rakefile +12 -0
- data/vendor/multi_json/lib/multi_json.rb +157 -0
- data/vendor/multi_json/lib/multi_json/adapter.rb +48 -0
- data/vendor/multi_json/lib/multi_json/adapters/gson.rb +19 -0
- data/vendor/multi_json/lib/multi_json/adapters/jr_jackson.rb +19 -0
- data/vendor/multi_json/lib/multi_json/adapters/json_common.rb +25 -0
- data/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +11 -0
- data/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +11 -0
- data/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +34 -0
- data/vendor/multi_json/lib/multi_json/adapters/oj.rb +24 -0
- data/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +22 -0
- data/vendor/multi_json/lib/multi_json/adapters/yajl.rb +19 -0
- data/vendor/multi_json/lib/multi_json/convertible_hash_keys.rb +43 -0
- data/vendor/multi_json/lib/multi_json/load_error.rb +11 -0
- data/vendor/multi_json/lib/multi_json/options.rb +48 -0
- data/vendor/multi_json/lib/multi_json/vendor/okjson.rb +606 -0
- data/vendor/multi_json/lib/multi_json/version.rb +20 -0
- data/vendor/multi_json/multi_json.gemspec +22 -0
- data/vendor/multi_json/spec/adapter_shared_example.rb +235 -0
- data/vendor/multi_json/spec/has_options.rb +119 -0
- data/vendor/multi_json/spec/helper.rb +35 -0
- data/vendor/multi_json/spec/json_common_shared_example.rb +30 -0
- data/vendor/multi_json/spec/multi_json_spec.rb +226 -0
- data/vendor/{signature → pusher}/.document +0 -0
- data/vendor/{json_pure/diagrams/.keep → pusher/.gemtest} +0 -0
- data/vendor/pusher/.gitignore +23 -0
- data/vendor/pusher/.travis.yml +15 -0
- data/vendor/pusher/Gemfile +2 -0
- data/vendor/{pusher-gem → pusher}/LICENSE +1 -1
- data/vendor/pusher/README.md +186 -0
- data/vendor/{pusher-gem → pusher}/Rakefile +0 -0
- data/vendor/{pusher-gem → pusher}/examples/async_message.rb +0 -0
- data/vendor/pusher/lib/pusher.rb +60 -0
- data/vendor/{pusher-gem → pusher}/lib/pusher/channel.rb +47 -54
- data/vendor/pusher/lib/pusher/client.rb +306 -0
- data/vendor/pusher/lib/pusher/request.rb +107 -0
- data/vendor/pusher/lib/pusher/resource.rb +36 -0
- data/vendor/pusher/lib/pusher/webhook.rb +110 -0
- data/vendor/{pusher-gem → pusher}/pusher.gemspec +6 -5
- data/vendor/pusher/spec/channel_spec.rb +127 -0
- data/vendor/pusher/spec/client_spec.rb +464 -0
- data/vendor/{pusher-gem → pusher}/spec/spec_helper.rb +12 -0
- data/vendor/pusher/spec/web_hook_spec.rb +117 -0
- data/vendor/signature/.travis.yml +15 -0
- data/vendor/signature/Gemfile +1 -1
- data/vendor/signature/README.md +38 -28
- data/vendor/signature/lib/signature.rb +97 -15
- data/vendor/signature/lib/signature/query_encoder.rb +47 -0
- data/vendor/signature/lib/signature/version.rb +1 -1
- data/vendor/signature/signature.gemspec +3 -2
- data/vendor/signature/spec/signature_spec.rb +164 -55
- data/vendor/signature/spec/spec_helper.rb +2 -3
- metadata +120 -145
- data/vendor/json_pure/.gitignore +0 -12
- data/vendor/json_pure/.travis.yml +0 -20
- data/vendor/json_pure/CHANGES +0 -282
- data/vendor/json_pure/COPYING +0 -58
- data/vendor/json_pure/COPYING-json-jruby +0 -57
- data/vendor/json_pure/GPL +0 -340
- data/vendor/json_pure/Gemfile +0 -11
- data/vendor/json_pure/README-json-jruby.markdown +0 -33
- data/vendor/json_pure/README.rdoc +0 -358
- data/vendor/json_pure/Rakefile +0 -412
- data/vendor/json_pure/TODO +0 -1
- data/vendor/json_pure/VERSION +0 -1
- data/vendor/json_pure/data/example.json +0 -1
- data/vendor/json_pure/data/index.html +0 -38
- data/vendor/json_pure/data/prototype.js +0 -4184
- data/vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h +0 -181
- data/vendor/json_pure/ext/json/ext/generator/depend +0 -1
- data/vendor/json_pure/ext/json/ext/generator/extconf.rb +0 -14
- data/vendor/json_pure/ext/json/ext/generator/generator.c +0 -1435
- data/vendor/json_pure/ext/json/ext/generator/generator.h +0 -148
- data/vendor/json_pure/ext/json/ext/parser/depend +0 -1
- data/vendor/json_pure/ext/json/ext/parser/extconf.rb +0 -13
- data/vendor/json_pure/ext/json/ext/parser/parser.c +0 -2204
- data/vendor/json_pure/ext/json/ext/parser/parser.h +0 -77
- data/vendor/json_pure/ext/json/ext/parser/parser.rl +0 -927
- data/vendor/json_pure/install.rb +0 -23
- data/vendor/json_pure/java/src/json/ext/ByteListTranscoder.java +0 -167
- data/vendor/json_pure/java/src/json/ext/Generator.java +0 -444
- data/vendor/json_pure/java/src/json/ext/GeneratorMethods.java +0 -232
- data/vendor/json_pure/java/src/json/ext/GeneratorService.java +0 -43
- data/vendor/json_pure/java/src/json/ext/GeneratorState.java +0 -543
- data/vendor/json_pure/java/src/json/ext/OptionsReader.java +0 -114
- data/vendor/json_pure/java/src/json/ext/Parser.java +0 -2644
- data/vendor/json_pure/java/src/json/ext/Parser.rl +0 -968
- data/vendor/json_pure/java/src/json/ext/ParserService.java +0 -35
- data/vendor/json_pure/java/src/json/ext/RuntimeInfo.java +0 -121
- data/vendor/json_pure/java/src/json/ext/StringDecoder.java +0 -167
- data/vendor/json_pure/java/src/json/ext/StringEncoder.java +0 -106
- data/vendor/json_pure/java/src/json/ext/Utils.java +0 -89
- data/vendor/json_pure/json-java.gemspec +0 -23
- data/vendor/json_pure/json.gemspec +0 -37
- data/vendor/json_pure/json_pure.gemspec +0 -39
- data/vendor/json_pure/lib/json.rb +0 -62
- data/vendor/json_pure/lib/json/add/bigdecimal.rb +0 -28
- data/vendor/json_pure/lib/json/add/complex.rb +0 -22
- data/vendor/json_pure/lib/json/add/core.rb +0 -11
- data/vendor/json_pure/lib/json/add/date.rb +0 -34
- data/vendor/json_pure/lib/json/add/date_time.rb +0 -50
- data/vendor/json_pure/lib/json/add/exception.rb +0 -31
- data/vendor/json_pure/lib/json/add/ostruct.rb +0 -31
- data/vendor/json_pure/lib/json/add/range.rb +0 -29
- data/vendor/json_pure/lib/json/add/rational.rb +0 -22
- data/vendor/json_pure/lib/json/add/regexp.rb +0 -30
- data/vendor/json_pure/lib/json/add/struct.rb +0 -30
- data/vendor/json_pure/lib/json/add/symbol.rb +0 -25
- data/vendor/json_pure/lib/json/add/time.rb +0 -38
- data/vendor/json_pure/lib/json/common.rb +0 -487
- data/vendor/json_pure/lib/json/ext.rb +0 -21
- data/vendor/json_pure/lib/json/ext/.keep +0 -0
- data/vendor/json_pure/lib/json/generic_object.rb +0 -70
- data/vendor/json_pure/lib/json/pure.rb +0 -21
- data/vendor/json_pure/lib/json/pure/generator.rb +0 -522
- data/vendor/json_pure/lib/json/pure/parser.rb +0 -359
- data/vendor/json_pure/lib/json/version.rb +0 -8
- data/vendor/json_pure/tests/fixtures/fail1.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail10.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail11.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail12.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail13.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail14.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail18.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail19.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail2.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail20.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail21.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail22.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail23.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail24.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail25.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail27.json +0 -2
- data/vendor/json_pure/tests/fixtures/fail28.json +0 -2
- data/vendor/json_pure/tests/fixtures/fail3.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail4.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail5.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail6.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail7.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail8.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail9.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass1.json +0 -56
- data/vendor/json_pure/tests/fixtures/pass15.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass16.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass17.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass2.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass26.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass3.json +0 -6
- data/vendor/json_pure/tests/setup_variant.rb +0 -11
- data/vendor/json_pure/tests/test_json.rb +0 -545
- data/vendor/json_pure/tests/test_json_addition.rb +0 -196
- data/vendor/json_pure/tests/test_json_encoding.rb +0 -65
- data/vendor/json_pure/tests/test_json_fixtures.rb +0 -35
- data/vendor/json_pure/tests/test_json_generate.rb +0 -322
- data/vendor/json_pure/tests/test_json_generic_object.rb +0 -75
- data/vendor/json_pure/tests/test_json_string_matching.rb +0 -39
- data/vendor/json_pure/tests/test_json_unicode.rb +0 -72
- data/vendor/json_pure/tools/fuzz.rb +0 -139
- data/vendor/json_pure/tools/server.rb +0 -62
- data/vendor/pusher-gem/Gemfile +0 -2
- data/vendor/pusher-gem/README.md +0 -80
- data/vendor/pusher-gem/lib/pusher.rb +0 -107
- data/vendor/pusher-gem/lib/pusher/request.rb +0 -107
- data/vendor/pusher-gem/spec/channel_spec.rb +0 -274
- data/vendor/pusher-gem/spec/pusher_spec.rb +0 -87
- data/vendor/ruby-hmac/History.txt +0 -15
- data/vendor/ruby-hmac/Manifest.txt +0 -11
- data/vendor/ruby-hmac/README.md +0 -41
- data/vendor/ruby-hmac/Rakefile +0 -23
- data/vendor/ruby-hmac/lib/hmac-md5.rb +0 -11
- data/vendor/ruby-hmac/lib/hmac-rmd160.rb +0 -11
- data/vendor/ruby-hmac/lib/hmac-sha1.rb +0 -11
- data/vendor/ruby-hmac/lib/hmac-sha2.rb +0 -25
- data/vendor/ruby-hmac/lib/hmac.rb +0 -118
- data/vendor/ruby-hmac/lib/ruby_hmac.rb +0 -2
- data/vendor/ruby-hmac/ruby-hmac.gemspec +0 -33
- data/vendor/ruby-hmac/test/test_hmac.rb +0 -89
- data/vendor/signature/VERSION +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path('helper', File.dirname(__FILE__))
|
|
3
|
+
|
|
4
|
+
require 'httpclient/include_client'
|
|
5
|
+
class TestIncludeClient < Test::Unit::TestCase
|
|
6
|
+
class Widget
|
|
7
|
+
extend HTTPClient::IncludeClient
|
|
8
|
+
|
|
9
|
+
include_http_client("http://example.com") do |client|
|
|
10
|
+
client.cookie_manager = nil
|
|
11
|
+
client.agent_name = "iMonkey 4k"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class OtherWidget
|
|
16
|
+
extend HTTPClient::IncludeClient
|
|
17
|
+
|
|
18
|
+
include_http_client
|
|
19
|
+
include_http_client(:method_name => :other_http_client)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class UnrelatedBlankClass ; end
|
|
23
|
+
|
|
24
|
+
def test_client_class_level_singleton
|
|
25
|
+
assert_equal Widget.http_client.object_id, Widget.http_client.object_id
|
|
26
|
+
|
|
27
|
+
assert_equal Widget.http_client.object_id, Widget.new.http_client.object_id
|
|
28
|
+
|
|
29
|
+
assert_not_equal Widget.http_client.object_id, OtherWidget.http_client.object_id
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_configured
|
|
33
|
+
assert_equal Widget.http_client.agent_name, "iMonkey 4k"
|
|
34
|
+
assert_nil Widget.http_client.cookie_manager
|
|
35
|
+
assert_equal Widget.http_client.proxy.to_s, "http://example.com"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_two_includes
|
|
39
|
+
assert_not_equal OtherWidget.http_client.object_id, OtherWidget.other_http_client.object_id
|
|
40
|
+
|
|
41
|
+
assert_equal OtherWidget.other_http_client.object_id, OtherWidget.new.other_http_client.object_id
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# meta-programming gone wrong sometimes accidentally
|
|
45
|
+
# adds the class method to _everyone_, a mistake we've made before.
|
|
46
|
+
def test_not_infected_class_hieararchy
|
|
47
|
+
assert ! Class.respond_to?(:http_client)
|
|
48
|
+
assert ! UnrelatedBlankClass.respond_to?(:http_client)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
end
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
require File.expand_path('helper', File.dirname(__FILE__))
|
|
2
|
+
require 'webrick/https'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class TestSSL < Test::Unit::TestCase
|
|
6
|
+
include Helper
|
|
7
|
+
DIR = File.dirname(File.expand_path(__FILE__))
|
|
8
|
+
|
|
9
|
+
def setup
|
|
10
|
+
super
|
|
11
|
+
@serverpid = @client = nil
|
|
12
|
+
@verify_callback_called = false
|
|
13
|
+
@verbose, $VERBOSE = $VERBOSE, nil
|
|
14
|
+
setup_server
|
|
15
|
+
setup_client
|
|
16
|
+
@url = "https://localhost:#{serverport}/hello"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def teardown
|
|
20
|
+
super
|
|
21
|
+
$VERBOSE = @verbose
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def path(filename)
|
|
25
|
+
File.expand_path(filename, DIR)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_options
|
|
29
|
+
cfg = @client.ssl_config
|
|
30
|
+
assert_nil(cfg.client_cert)
|
|
31
|
+
assert_nil(cfg.client_key)
|
|
32
|
+
assert_nil(cfg.client_ca)
|
|
33
|
+
assert_equal(OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT, cfg.verify_mode)
|
|
34
|
+
assert_nil(cfg.verify_callback)
|
|
35
|
+
assert_nil(cfg.timeout)
|
|
36
|
+
assert_equal(OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_SSLv2, cfg.options)
|
|
37
|
+
assert_equal("ALL:!aNULL:!eNULL:!SSLv2", cfg.ciphers)
|
|
38
|
+
assert_instance_of(OpenSSL::X509::Store, cfg.cert_store)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_sync
|
|
42
|
+
cfg = @client.ssl_config
|
|
43
|
+
cfg.set_client_cert_file(path('client.cert'), path('client.key'))
|
|
44
|
+
cfg.add_trust_ca(path('ca.cert'))
|
|
45
|
+
cfg.add_trust_ca(path('subca.cert'))
|
|
46
|
+
assert_equal("hello", @client.get_content(@url))
|
|
47
|
+
|
|
48
|
+
@client.socket_sync = false
|
|
49
|
+
@client.reset_all
|
|
50
|
+
assert_equal("hello", @client.get_content(@url))
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_debug_dev
|
|
54
|
+
str = @client.debug_dev = ''
|
|
55
|
+
cfg = @client.ssl_config
|
|
56
|
+
cfg.client_cert = cert("client.cert")
|
|
57
|
+
cfg.client_key = key("client.key")
|
|
58
|
+
cfg.add_trust_ca(path('ca.cert'))
|
|
59
|
+
cfg.add_trust_ca(path('subca.cert'))
|
|
60
|
+
assert_equal("hello", @client.get_content(@url))
|
|
61
|
+
assert(str.scan(/^hello$/)[0])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_verification
|
|
65
|
+
cfg = @client.ssl_config
|
|
66
|
+
cfg.verify_callback = method(:verify_callback).to_proc
|
|
67
|
+
begin
|
|
68
|
+
@verify_callback_called = false
|
|
69
|
+
@client.get(@url)
|
|
70
|
+
assert(false)
|
|
71
|
+
rescue OpenSSL::SSL::SSLError => ssle
|
|
72
|
+
assert_match(/certificate verify failed/, ssle.message)
|
|
73
|
+
assert(@verify_callback_called)
|
|
74
|
+
end
|
|
75
|
+
#
|
|
76
|
+
cfg.client_cert = cert("client.cert")
|
|
77
|
+
cfg.client_key = key("client.key")
|
|
78
|
+
@verify_callback_called = false
|
|
79
|
+
begin
|
|
80
|
+
@client.get(@url)
|
|
81
|
+
assert(false)
|
|
82
|
+
rescue OpenSSL::SSL::SSLError => ssle
|
|
83
|
+
assert_match(/certificate verify failed/, ssle.message)
|
|
84
|
+
assert(@verify_callback_called)
|
|
85
|
+
end
|
|
86
|
+
#
|
|
87
|
+
cfg.add_trust_ca(path('ca.cert'))
|
|
88
|
+
@verify_callback_called = false
|
|
89
|
+
begin
|
|
90
|
+
@client.get(@url)
|
|
91
|
+
assert(false)
|
|
92
|
+
rescue OpenSSL::SSL::SSLError => ssle
|
|
93
|
+
assert_match(/certificate verify failed/, ssle.message)
|
|
94
|
+
assert(@verify_callback_called)
|
|
95
|
+
end
|
|
96
|
+
#
|
|
97
|
+
cfg.add_trust_ca(path('subca.cert'))
|
|
98
|
+
@verify_callback_called = false
|
|
99
|
+
assert_equal("hello", @client.get_content(@url))
|
|
100
|
+
assert(@verify_callback_called)
|
|
101
|
+
#
|
|
102
|
+
unless ENV['TRAVIS']
|
|
103
|
+
# On travis environment, verify_depth seems to not work properly.
|
|
104
|
+
# Ubuntu 10.04 + OpenSSL 0.9.8k issue?
|
|
105
|
+
cfg.verify_depth = 1 # 2 required: root-sub
|
|
106
|
+
@verify_callback_called = false
|
|
107
|
+
begin
|
|
108
|
+
@client.get(@url)
|
|
109
|
+
assert(false, "verify_depth is not supported? #{OpenSSL::OPENSSL_VERSION}")
|
|
110
|
+
rescue OpenSSL::SSL::SSLError => ssle
|
|
111
|
+
assert_match(/certificate verify failed/, ssle.message)
|
|
112
|
+
assert(@verify_callback_called)
|
|
113
|
+
end
|
|
114
|
+
#
|
|
115
|
+
cfg.verify_depth = 2 # 2 required: root-sub
|
|
116
|
+
@verify_callback_called = false
|
|
117
|
+
@client.get(@url)
|
|
118
|
+
assert(@verify_callback_called)
|
|
119
|
+
#
|
|
120
|
+
end
|
|
121
|
+
cfg.verify_depth = nil
|
|
122
|
+
cfg.cert_store = OpenSSL::X509::Store.new
|
|
123
|
+
cfg.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
124
|
+
begin
|
|
125
|
+
@client.get_content(@url)
|
|
126
|
+
assert(false)
|
|
127
|
+
rescue OpenSSL::SSL::SSLError => ssle
|
|
128
|
+
assert_match(/certificate verify failed/, ssle.message)
|
|
129
|
+
end
|
|
130
|
+
#
|
|
131
|
+
cfg.verify_mode = nil
|
|
132
|
+
assert_equal("hello", @client.get_content(@url))
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def test_ciphers
|
|
136
|
+
cfg = @client.ssl_config
|
|
137
|
+
cfg.set_client_cert_file(path('client.cert'), path('client.key'))
|
|
138
|
+
cfg.add_trust_ca(path('ca.cert'))
|
|
139
|
+
cfg.add_trust_ca(path('subca.cert'))
|
|
140
|
+
cfg.timeout = 123
|
|
141
|
+
assert_equal("hello", @client.get_content(@url))
|
|
142
|
+
#
|
|
143
|
+
cfg.ciphers = "!ALL"
|
|
144
|
+
begin
|
|
145
|
+
@client.get(@url)
|
|
146
|
+
assert(false)
|
|
147
|
+
rescue OpenSSL::SSL::SSLError => ssle
|
|
148
|
+
assert_match(/no cipher match/, ssle.message)
|
|
149
|
+
end
|
|
150
|
+
#
|
|
151
|
+
cfg.ciphers = "ALL"
|
|
152
|
+
assert_equal("hello", @client.get_content(@url))
|
|
153
|
+
#
|
|
154
|
+
cfg.ciphers = "DEFAULT"
|
|
155
|
+
assert_equal("hello", @client.get_content(@url))
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def test_set_default_paths
|
|
159
|
+
assert_raise(OpenSSL::SSL::SSLError) do
|
|
160
|
+
@client.get(@url)
|
|
161
|
+
end
|
|
162
|
+
escape_env do
|
|
163
|
+
ENV['SSL_CERT_FILE'] = File.join(DIR, 'ca-chain.cert')
|
|
164
|
+
@client.ssl_config.set_default_paths
|
|
165
|
+
@client.get(@url)
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
private
|
|
170
|
+
|
|
171
|
+
def cert(filename)
|
|
172
|
+
OpenSSL::X509::Certificate.new(File.read(File.join(DIR, filename)))
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def key(filename)
|
|
176
|
+
OpenSSL::PKey::RSA.new(File.read(File.join(DIR, filename)))
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def q(str)
|
|
180
|
+
%Q["#{str}"]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def setup_server
|
|
184
|
+
logger = Logger.new(STDERR)
|
|
185
|
+
logger.level = Logger::Severity::FATAL # avoid logging SSLError (ERROR level)
|
|
186
|
+
@server = WEBrick::HTTPServer.new(
|
|
187
|
+
:BindAddress => "localhost",
|
|
188
|
+
:Logger => logger,
|
|
189
|
+
:Port => 0,
|
|
190
|
+
:AccessLog => [],
|
|
191
|
+
:DocumentRoot => DIR,
|
|
192
|
+
:SSLEnable => true,
|
|
193
|
+
:SSLCACertificateFile => File.join(DIR, 'ca.cert'),
|
|
194
|
+
:SSLCertificate => cert('server.cert'),
|
|
195
|
+
:SSLPrivateKey => key('server.key'),
|
|
196
|
+
:SSLVerifyClient => nil, #OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT|OpenSSL::SSL::VERIFY_PEER,
|
|
197
|
+
:SSLClientCA => cert('ca.cert'),
|
|
198
|
+
:SSLCertName => nil
|
|
199
|
+
)
|
|
200
|
+
@serverport = @server.config[:Port]
|
|
201
|
+
[:hello].each do |sym|
|
|
202
|
+
@server.mount(
|
|
203
|
+
"/#{sym}",
|
|
204
|
+
WEBrick::HTTPServlet::ProcHandler.new(method("do_#{sym}").to_proc)
|
|
205
|
+
)
|
|
206
|
+
end
|
|
207
|
+
@server_thread = start_server_thread(@server)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def do_hello(req, res)
|
|
211
|
+
res['content-type'] = 'text/html'
|
|
212
|
+
res.body = "hello"
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def start_server_thread(server)
|
|
216
|
+
t = Thread.new {
|
|
217
|
+
Thread.current.abort_on_exception = true
|
|
218
|
+
server.start
|
|
219
|
+
}
|
|
220
|
+
while server.status != :Running
|
|
221
|
+
sleep 0.1
|
|
222
|
+
unless t.alive?
|
|
223
|
+
t.join
|
|
224
|
+
raise
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
t
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def verify_callback(ok, cert)
|
|
231
|
+
@verify_callback_called = true
|
|
232
|
+
p ["client", ok, cert] if $DEBUG
|
|
233
|
+
ok
|
|
234
|
+
end
|
|
235
|
+
end
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
1.7.8
|
|
2
|
+
-----
|
|
3
|
+
* [Reorder JrJackson before json_gem](https://github.com/intridea/multi_json/commit/315b6e460b6e4dcdb6c82e04e4be8ee975d395da)
|
|
4
|
+
* [Update vendored OkJson to version 43](https://github.com/intridea/multi_json/commit/99a6b662f6ef4036e3ee94d7eb547fa72fb2ab50)
|
|
5
|
+
|
|
6
|
+
1.7.7
|
|
7
|
+
-----
|
|
8
|
+
* [Fix options caching issues](https://github.com/intridea/multi_json/commit/a3f14c3661688c5927638fa6088c7b46a67e875e)
|
|
9
|
+
|
|
10
|
+
1.7.6
|
|
11
|
+
-----
|
|
12
|
+
* [Bring back MultiJson::VERSION constant](https://github.com/intridea/multi_json/commit/31b990c2725e6673bf8ce57540fe66b57a751a72)
|
|
13
|
+
|
|
14
|
+
1.7.5
|
|
15
|
+
-----
|
|
16
|
+
* [Fix warning '*' interpreted as argument prefix](https://github.com/intridea/multi_json/commit/b698962c7f64430222a1f06430669706a47aff89)
|
|
17
|
+
* [Remove stdlib warning](https://github.com/intridea/multi_json/commit/d06eec6b7996ac8b4ff0e2229efd835379b0c30f)
|
|
18
|
+
|
|
19
|
+
1.7.4
|
|
20
|
+
-----
|
|
21
|
+
* [Cache options for better performance](https://github.com/intridea/multi_json/commit/8a26ee93140c4bed36194ed9fb887a1b6919257b)
|
|
22
|
+
|
|
23
|
+
1.7.3
|
|
24
|
+
-----
|
|
25
|
+
* [Require json/ext to ensure extension version gets loaded for json_gem](https://github.com/intridea/multi_json/commit/942686f7e8597418c6f90ee69e1d45242fac07b1)
|
|
26
|
+
* [Rename JrJackson](https://github.com/intridea/multi_json/commit/078de7ba8b6035343c3e96b4767549e9ec43369a)
|
|
27
|
+
* [Prefer JrJackson to JSON gem if present](https://github.com/intridea/multi_json/commit/af8bd9799a66855f04b3aff1c488485950cec7bf)
|
|
28
|
+
* [Print a warning if outdated gem versions are used](https://github.com/intridea/multi_json/commit/e7438e7ba2be0236cfa24c2bb9ad40ee821286d1)
|
|
29
|
+
* [Loosen required_rubygems_version for compatibility with Ubuntu 10.04](https://github.com/intridea/multi_json/commit/59fad014e8fe41dbc6f09485ea0dc21fc42fd7a7)
|
|
30
|
+
|
|
31
|
+
1.7.2
|
|
32
|
+
-----
|
|
33
|
+
* [Rename Jrjackson adapter to JrJackson](https://github.com/intridea/multi_json/commit/b36dc915fc0e6548cbad06b5db6f520e040c9c8b)
|
|
34
|
+
* [Implement jrjackson -> jr_jackson alias for back-compatability](https://github.com/intridea/multi_json/commit/aa50ab8b7bb646b8b75d5d65dfeadae8248a4f10)
|
|
35
|
+
* [Update vendored OkJson module](https://github.com/intridea/multi_json/commit/30a3f474e17dd86a697c3fab04f468d1a4fd69d7)
|
|
36
|
+
|
|
37
|
+
1.7.1
|
|
38
|
+
-----
|
|
39
|
+
* [Fix capitalization of JrJackson class](https://github.com/intridea/multi_json/commit/5373a5e38c647f02427a0477cb8e0e0dafad1b8d)
|
|
40
|
+
|
|
41
|
+
1.7.0
|
|
42
|
+
-----
|
|
43
|
+
* [Add load_options/dump_options to MultiJson](https://github.com/intridea/multi_json/commit/a153956be6b0df06ea1705ce3c1ff0b5b0e27ea5)
|
|
44
|
+
* [MultiJson does not modify arguments](https://github.com/intridea/multi_json/commit/58525b01c4c2f6635ba2ac13d6fd987b79f3962f)
|
|
45
|
+
* [Enable quirks_mode by default for json_gem/json_pure adapters](https://github.com/intridea/multi_json/commit/1fd4e6635c436515b7d7d5a0bee4548de8571520)
|
|
46
|
+
* [Add JrJackson adapter](https://github.com/intridea/multi_json/commit/4dd86fa96300aaaf6d762578b9b31ea82adb056d)
|
|
47
|
+
* [Raise ArgumentError on bad adapter input](https://github.com/intridea/multi_json/commit/911a3756bdff2cb5ac06497da3fa3e72199cb7ad)
|
|
48
|
+
|
|
49
|
+
1.6.1
|
|
50
|
+
-----
|
|
51
|
+
* [Revert "Use JSON.generate instead of #to_json"](https://github.com/intridea/multi_json/issues/86)
|
|
52
|
+
|
|
53
|
+
1.6.0
|
|
54
|
+
-----
|
|
55
|
+
* [Add gson.rb support](https://github.com/intridea/multi_json/pull/71)
|
|
56
|
+
* [Add MultiJson.default_options](https://github.com/intridea/multi_json/pull/70)
|
|
57
|
+
* [Add MultiJson.with_adapter](https://github.com/intridea/multi_json/pull/67)
|
|
58
|
+
* [Stringify all possible keys for ok_json](https://github.com/intridea/multi_json/pull/66)
|
|
59
|
+
* [Use JSON.generate instead of #to_json](https://github.com/intridea/multi_json/issues/73)
|
|
60
|
+
* [Alias `MultiJson::DecodeError` to `MultiJson::LoadError`](https://github.com/intridea/multi_json/pull/79)
|
|
61
|
+
|
|
62
|
+
1.5.1
|
|
63
|
+
-----
|
|
64
|
+
* [Do not allow Oj or JSON to create symbols by searching for classes](https://github.com/intridea/multi_json/commit/193e28cf4dc61b6e7b7b7d80f06f74c76df65c41)
|
|
65
|
+
|
|
66
|
+
1.5.0
|
|
67
|
+
-----
|
|
68
|
+
* [Add `MultiJson.with_adapter` method](https://github.com/intridea/multi_json/commit/d14c5d28cae96557a0421298621b9499e1f28104)
|
|
69
|
+
* [Stringify all possible keys for `ok_json`](https://github.com/intridea/multi_json/commit/73998074058e1e58c557ffa7b9541d486d6041fa)
|
|
70
|
+
|
|
71
|
+
1.4.0
|
|
72
|
+
-----
|
|
73
|
+
* [Allow `load`/`dump` of JSON fragments](https://github.com/intridea/multi_json/commit/707aae7d48d39c85b38febbd2c210ba87f6e4a36)
|
|
74
|
+
|
|
75
|
+
1.3.7
|
|
76
|
+
-----
|
|
77
|
+
* [Fix rescue clause for MagLev](https://github.com/intridea/multi_json/commit/39abdf50199828c50e85b2ce8f8ba31fcbbc9332)
|
|
78
|
+
* [Remove unnecessary check for string version of options key](https://github.com/intridea/multi_json/commit/660101b70e962b3c007d0b90d45944fa47d13ec4)
|
|
79
|
+
* [Explicitly set default adapter when adapter is set to `nil` or `false`](https://github.com/intridea/multi_json/commit/a9e587d5a63eafb4baee9fb211265e4dd96a26bc)
|
|
80
|
+
* [Fix Oj `ParseError` mapping for Oj 1.4.0](https://github.com/intridea/multi_json/commit/7d9045338cc9029401c16f3c409d54ce97f275e2)
|
|
81
|
+
|
|
82
|
+
1.3.6
|
|
83
|
+
-----
|
|
84
|
+
* [Allow adapter-specific options to be passed through to Oj](https://github.com/intridea/multi_json/commit/d0e5feeebcba0bc69400dd203a295f5c30971223)
|
|
85
|
+
|
|
86
|
+
1.3.5
|
|
87
|
+
-----
|
|
88
|
+
* [Add pretty support to Oj adapter](https://github.com/intridea/multi_json/commit/0c8f75f03020c53bcf4c6be258faf433d24b2c2b)
|
|
89
|
+
|
|
90
|
+
1.3.4
|
|
91
|
+
-----
|
|
92
|
+
* [Use `class << self` instead of `module_function` to create aliases](https://github.com/intridea/multi_json/commit/ba1451c4c48baa297e049889be241a424cb05980)
|
|
93
|
+
|
|
94
|
+
1.3.3
|
|
95
|
+
-----
|
|
96
|
+
* [Remove deprecation warnings](https://github.com/intridea/multi_json/commit/36b524e71544eb0186826a891bcc03b2820a008f)
|
|
97
|
+
|
|
98
|
+
1.3.2
|
|
99
|
+
-----
|
|
100
|
+
* [Add ability to use adapter per call](https://github.com/intridea/multi_json/commit/106bbec469d5d0a832bfa31fffcb8c0f0cdc9bd3)
|
|
101
|
+
* [Add and deprecate `default_engine` method](https://github.com/intridea/multi_json/commit/fc3df0c7a3e2ab9ce0c2c7e7617a4da97dd13f6e)
|
|
102
|
+
|
|
103
|
+
1.3.1
|
|
104
|
+
-----
|
|
105
|
+
* [Only warn once for each instance a deprecated method is called](https://github.com/intridea/multi_json/commit/e21d6eb7da74b3f283995c1d27d5880e75f0ae84)
|
|
106
|
+
|
|
107
|
+
1.3.0
|
|
108
|
+
-----
|
|
109
|
+
* [Implement `load`/`dump`; deprecate `decode`/`encode`](https://github.com/intridea/multi_json/commit/e90fd6cb1b0293eb0c73c2f4eb0f7a1764370216)
|
|
110
|
+
* [Rename engines to adapters](https://github.com/intridea/multi_json/commit/ae7fd144a7949a9c221dcaa446196ec23db908df)
|
|
111
|
+
|
|
112
|
+
1.2.0
|
|
113
|
+
-----
|
|
114
|
+
* [Add support for Oj](https://github.com/intridea/multi_json/commit/acd06b233edabe6c44f226873db7b49dab560c60)
|
|
115
|
+
|
|
116
|
+
1.1.0
|
|
117
|
+
-----
|
|
118
|
+
* [`NSJSONSerialization` support for MacRuby](https://github.com/intridea/multi_json/commit/f862e2fc966cac8867fe7da3997fc76e8a6cf5d4)
|
|
119
|
+
|
|
120
|
+
1.0.4
|
|
121
|
+
-----
|
|
122
|
+
* [Set data context to `DecodeError` exception](https://github.com/intridea/multi_json/commit/19ddafd44029c6681f66fae2a0f6eabfd0f85176)
|
|
123
|
+
* [Allow `ok_json` to fallback to `to_json`](https://github.com/intridea/multi_json/commit/c157240b1193b283d06d1bd4d4b5b06bcf3761f8)
|
|
124
|
+
* [Add warning when using `ok_json`](https://github.com/intridea/multi_json/commit/dd4b68810c84f826fb98f9713bfb29ab96888d57)
|
|
125
|
+
* [Options can be passed to an engine on encode](https://github.com/intridea/multi_json/commit/e0a7ff5d5ff621ffccc61617ed8aeec5816e81f7)
|
|
126
|
+
|
|
127
|
+
1.0.3
|
|
128
|
+
-----
|
|
129
|
+
* [`Array` support for `stringify_keys`](https://github.com/intridea/multi_json/commit/644d1c5c7c7f6a27663b11668527b346094e38b9)
|
|
130
|
+
* [`Array` support for `symbolize_keys`](https://github.com/intridea/multi_json/commit/c885377d47a2aa39cb0d971fea78db2d2fa479a7)
|
|
131
|
+
|
|
132
|
+
1.0.2
|
|
133
|
+
-----
|
|
134
|
+
* [Allow encoding of rootless JSON when `ok_json` is used](https://github.com/intridea/multi_json/commit/d1cde7de97cb0f6152aef8daf14037521cdce8c6)
|
|
135
|
+
|
|
136
|
+
1.0.1
|
|
137
|
+
-----
|
|
138
|
+
* [Correct an issue with `ok_json` not being returned as the default engine](https://github.com/intridea/multi_json/commit/d33c141619c54cccd770199694da8fd1bd8f449d)
|
|
139
|
+
|
|
140
|
+
1.0.0
|
|
141
|
+
-----
|
|
142
|
+
* [Remove `ActiveSupport::JSON` support](https://github.com/intridea/multi_json/commit/c2f4140141d785a24b3f56e58811b0e561b37f6a)
|
|
143
|
+
* [Fix `@engine` ivar warning](https://github.com/intridea/multi_json/commit/3b978a8995721a8dffedc3b75a7f49e5494ec553)
|
|
144
|
+
* [Only `rescue` from parsing errors during decoding, not any `StandardError`](https://github.com/intridea/multi_json/commit/391d00b5e85294d42d41347605d8d46b4a7f66cc)
|
|
145
|
+
* [Rename `okjson` engine and vendored lib to `ok_json`](https://github.com/intridea/multi_json/commit/5bd1afc977a8208ddb0443e1d57cb79665c019f1)
|
|
146
|
+
* [Add `StringIO` support to `json` gem and `ok_json`](https://github.com/intridea/multi_json/commit/1706b11568db7f50af451fce5f4d679aeb3bbe8f)
|
|
147
|
+
|
|
148
|
+
0.0.5
|
|
149
|
+
-----
|
|
150
|
+
* [Trap all JSON decoding errors; raise `MultiJson::DecodeError`](https://github.com/intridea/multi_json/commit/dea9a1aef6dd1212aa1e5a37ab1669f9b045b732)
|
|
151
|
+
|
|
152
|
+
0.0.4
|
|
153
|
+
-----
|
|
154
|
+
* [Fix default_engine check for `json` gem](https://github.com/intridea/multi_json/commit/caced0c4e8c795922a109ebc00c3c4fa8635bed8)
|
|
155
|
+
* [Make requirement mapper an `Array` to preserve order in Ruby versions < 1.9](https://github.com/intridea/multi_json/commit/526f5f29a42131574a088ad9bbb43d7f48439b2c)
|
|
156
|
+
|
|
157
|
+
0.0.3
|
|
158
|
+
-----
|
|
159
|
+
* [Improve defaulting and documentation](https://github.com/sferik/twitter/commit/3a0e41b9e4b0909201045fa47704b78c9d949b73)
|
|
160
|
+
|
|
161
|
+
0.0.2
|
|
162
|
+
-----
|
|
163
|
+
|
|
164
|
+
* [Rename to `multi_json`](https://github.com/sferik/twitter/commit/461ab89ce071c8c9fabfc183581e0ec523788b62)
|
|
165
|
+
|
|
166
|
+
0.0.1
|
|
167
|
+
-----
|
|
168
|
+
|
|
169
|
+
* [Initial commit](https://github.com/sferik/twitter/commit/518c21ab299c500527491e6c049ab2229e22a805)
|