scout 5.7.1 → 5.7.2.pre
Sign up to get free protection for your applications and to get access to all the features.
- 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,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# wcat for http-access2
|
4
|
+
# Copyright (C) 2001 TAKAHASHI Masayoshi
|
5
|
+
|
6
|
+
$:.unshift(File.join('..', 'lib'))
|
7
|
+
require 'httpclient'
|
8
|
+
|
9
|
+
if ENV['HTTP_PROXY']
|
10
|
+
h = HTTPClient.new(ENV['HTTP_PROXY'])
|
11
|
+
else
|
12
|
+
h = HTTPClient.new()
|
13
|
+
end
|
14
|
+
|
15
|
+
while urlstr = ARGV.shift
|
16
|
+
response = h.get(urlstr){ |data|
|
17
|
+
print data
|
18
|
+
}
|
19
|
+
p response.contenttype
|
20
|
+
p response.peer_cert if /^https/i =~ urlstr
|
21
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIID0DCCArigAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
|
3
|
+
MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
|
4
|
+
DTA0MDEzMDAwNDIzMloXDTM2MDEyMjAwNDIzMlowPDELMAkGA1UEBgwCSlAxEjAQ
|
5
|
+
BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQswCQYDVQQDDAJDQTCCASIw
|
6
|
+
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANbv0x42BTKFEQOE+KJ2XmiSdZpR
|
7
|
+
wjzQLAkPLRnLB98tlzs4xo+y4RyY/rd5TT9UzBJTIhP8CJi5GbS1oXEerQXB3P0d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
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'test/unit'
|
3
|
+
begin
|
4
|
+
require 'simplecov'
|
5
|
+
require 'simplecov-rcov'
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
7
|
+
SimpleCov.start
|
8
|
+
rescue LoadError
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'httpclient'
|
12
|
+
require 'webrick'
|
13
|
+
require 'webrick/httpproxy.rb'
|
14
|
+
require 'logger'
|
15
|
+
require 'stringio'
|
16
|
+
require 'cgi'
|
17
|
+
require 'webrick/httputils'
|
18
|
+
|
19
|
+
|
20
|
+
module Helper
|
21
|
+
Port = 17171
|
22
|
+
ProxyPort = 17172
|
23
|
+
|
24
|
+
def serverport
|
25
|
+
@serverport
|
26
|
+
end
|
27
|
+
|
28
|
+
def proxyport
|
29
|
+
@proxyport
|
30
|
+
end
|
31
|
+
|
32
|
+
def serverurl
|
33
|
+
"http://localhost:#{serverport}/"
|
34
|
+
end
|
35
|
+
|
36
|
+
def proxyurl
|
37
|
+
"http://localhost:#{proxyport}/"
|
38
|
+
end
|
39
|
+
|
40
|
+
def setup
|
41
|
+
@logger = Logger.new(STDERR)
|
42
|
+
@logger.level = Logger::Severity::FATAL
|
43
|
+
@proxyio = StringIO.new
|
44
|
+
@proxylogger = Logger.new(@proxyio)
|
45
|
+
@proxylogger.level = Logger::Severity::DEBUG
|
46
|
+
@server = @proxyserver = @client = nil
|
47
|
+
@server_thread = @proxyserver_thread = nil
|
48
|
+
@serverport = Port
|
49
|
+
@proxyport = ProxyPort
|
50
|
+
end
|
51
|
+
|
52
|
+
def teardown
|
53
|
+
teardown_client if @client
|
54
|
+
teardown_proxyserver if @proxyserver
|
55
|
+
teardown_server if @server
|
56
|
+
end
|
57
|
+
|
58
|
+
def setup_client
|
59
|
+
@client = HTTPClient.new
|
60
|
+
end
|
61
|
+
|
62
|
+
#def setup_server
|
63
|
+
# override it
|
64
|
+
# @server = WEBrick::HTTPServer.new(...)
|
65
|
+
# @server_thread = start_server_thread(@server)
|
66
|
+
#end
|
67
|
+
|
68
|
+
def setup_proxyserver
|
69
|
+
@proxyserver = WEBrick::HTTPProxyServer.new(
|
70
|
+
:BindAddress => "localhost",
|
71
|
+
:Logger => @proxylogger,
|
72
|
+
:Port => 0,
|
73
|
+
:AccessLog => []
|
74
|
+
)
|
75
|
+
@proxyport = @proxyserver.config[:Port]
|
76
|
+
@proxyserver_thread = start_server_thread(@proxyserver)
|
77
|
+
end
|
78
|
+
|
79
|
+
def teardown_client
|
80
|
+
@client.reset_all
|
81
|
+
end
|
82
|
+
|
83
|
+
def teardown_server
|
84
|
+
@server.shutdown
|
85
|
+
#@server_thread.kill
|
86
|
+
end
|
87
|
+
|
88
|
+
def teardown_proxyserver
|
89
|
+
@proxyserver.shutdown
|
90
|
+
#@proxyserver_thread.kill
|
91
|
+
end
|
92
|
+
|
93
|
+
def start_server_thread(server)
|
94
|
+
t = Thread.new {
|
95
|
+
Thread.current.abort_on_exception = true
|
96
|
+
server.start
|
97
|
+
}
|
98
|
+
while server.status != :Running
|
99
|
+
Thread.pass
|
100
|
+
unless t.alive?
|
101
|
+
t.join
|
102
|
+
raise
|
103
|
+
end
|
104
|
+
end
|
105
|
+
t
|
106
|
+
end
|
107
|
+
|
108
|
+
def params(str)
|
109
|
+
HTTP::Message.parse(str).inject({}) { |r, (k, v)| r[k] = v.first; r }
|
110
|
+
end
|
111
|
+
|
112
|
+
def silent
|
113
|
+
begin
|
114
|
+
back, $VERBOSE = $VERBOSE, nil
|
115
|
+
yield
|
116
|
+
ensure
|
117
|
+
$VERBOSE = back
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def escape_env
|
122
|
+
env = {}
|
123
|
+
env.update(ENV)
|
124
|
+
yield
|
125
|
+
ensure
|
126
|
+
ENV.clear
|
127
|
+
ENV.update(env)
|
128
|
+
end
|
129
|
+
end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rvaFoQ/WleogVQAeGVpdo7/DK9t9YWoFBIqth0L
|
13
|
+
mGSYFu9ZhvZkvQNV8eYrAkBJ+rOIaLDsmbrgkeDruH+B/9yrm4McDtQ/rgnOGYnH
|
14
|
+
LjLpLLOrgUxqpzLWe++EwSLwK2//dHO+SPsQJ4xsyQJy
|
15
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'webrick/https'
|
2
|
+
require 'logger'
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
PORT = 17171
|
6
|
+
DIR = File.dirname(File.expand_path(__FILE__))
|
7
|
+
|
8
|
+
def cert(filename)
|
9
|
+
OpenSSL::X509::Certificate.new(File.open(File.join(DIR, filename)) { |f|
|
10
|
+
f.read
|
11
|
+
})
|
12
|
+
end
|
13
|
+
|
14
|
+
def key(filename)
|
15
|
+
OpenSSL::PKey::RSA.new(File.open(File.join(DIR, filename)) { |f|
|
16
|
+
f.read
|
17
|
+
})
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_hello(req, res)
|
21
|
+
res['content-type'] = 'text/html'
|
22
|
+
res.body = "hello"
|
23
|
+
end
|
24
|
+
|
25
|
+
logger = Logger.new(STDERR)
|
26
|
+
logger.level = Logger::Severity::FATAL # avoid logging SSLError (ERROR level)
|
27
|
+
|
28
|
+
server = WEBrick::HTTPServer.new(
|
29
|
+
:BindAddress => "localhost",
|
30
|
+
:Logger => logger,
|
31
|
+
:Port => PORT,
|
32
|
+
:AccessLog => [],
|
33
|
+
:DocumentRoot => DIR,
|
34
|
+
:SSLEnable => true,
|
35
|
+
:SSLCACertificateFile => File.join(DIR, 'ca.cert'),
|
36
|
+
:SSLCertificate => cert('server.cert'),
|
37
|
+
:SSLPrivateKey => key('server.key'),
|
38
|
+
:SSLVerifyClient => nil, #OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT|OpenSSL::SSL::VERIFY_PEER,
|
39
|
+
:SSLClientCA => cert('ca.cert'),
|
40
|
+
:SSLCertName => nil
|
41
|
+
)
|
42
|
+
trap(:INT) do
|
43
|
+
server.shutdown
|
44
|
+
end
|
45
|
+
[:hello].each do |sym|
|
46
|
+
server.mount(
|
47
|
+
"/#{sym}",
|
48
|
+
WEBrick::HTTPServlet::ProcHandler.new(method("do_#{sym}").to_proc)
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
t = Thread.new {
|
53
|
+
Thread.current.abort_on_exception = true
|
54
|
+
server.start
|
55
|
+
}
|
56
|
+
while server.status != :Running
|
57
|
+
sleep 0.1
|
58
|
+
unless t.alive?
|
59
|
+
t.join
|
60
|
+
raise
|
61
|
+
end
|
62
|
+
end
|
63
|
+
STDOUT.sync = true
|
64
|
+
puts $$
|
65
|
+
t.join
|
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
|
3
|
+
MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
|
4
|
+
DTA0MDEzMDAwNDMyN1oXDTM1MDEyMjAwNDMyN1owPzELMAkGA1UEBgwCSlAxEjAQ
|
5
|
+
BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQ4wDAYDVQQDDAVTdWJDQTCC
|
6
|
+
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0Ou7AyRcRXnB/kVHv/6kwe
|
7
|
+
ANzgg/DyJfsAUqW90m7Lu1nqyug8gK0RBd77yU0w5HOAMHTVSdpjZK0g2sgx4Mb1
|
8
|
+
d/213eL9TTl5MRVEChTvQr8q5DVG/8fxPPE7fMI8eOAzd98/NOAChk+80r4Sx7fC
|
9
|
+
kGVEE1bKwY1MrUsUNjOY2d6t3M4HHV3HX1V8ShuKfsHxgCmLzdI8U+5CnQedFgkm
|
10
|
+
3e+8tr8IX5RR1wA1Ifw9VadF7OdI/bGMzog/Q8XCLf+WPFjnK7Gcx6JFtzF6Gi4x
|
11
|
+
4dp1Xl45JYiVvi9zQ132wu8A1pDHhiNgQviyzbP+UjcB/tsOpzBQF8abYzgEkWEC
|
12
|
+
AwEAAaNyMHAwDwYDVR0TAQH/BAUwAwEB/zAxBglghkgBhvhCAQ0EJBYiUnVieS9P
|
13
|
+
cGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUlCjXWLsReYzH
|
14
|
+
LzsxwVnCXmKoB/owCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQCJ/OyN
|
15
|
+
rT8Cq2Y+G2yA/L1EMRvvxwFBqxavqaqHl/6rwsIBFlB3zbqGA/0oec6MAVnYynq4
|
16
|
+
c4AcHTjx3bQ/S4r2sNTZq0DH4SYbQzIobx/YW8PjQUJt8KQdKMcwwi7arHP7A/Ha
|
17
|
+
LKu8eIC2nsUBnP4NhkYSGhbmpJK+PFD0FVtD0ZIRlY/wsnaZNjWWcnWF1/FNuQ4H
|
18
|
+
ySjIblqVQkPuzebv3Ror6ZnVDukn96Mg7kP4u6zgxOeqlJGRe1M949SS9Vudjl8X
|
19
|
+
SF4aZUUB9pQGhsqQJVqaz2OlhGOp9D0q54xko/rekjAIcuDjl1mdX4F2WRrzpUmZ
|
20
|
+
uY/bPeOBYiVsOYVe
|
21
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,321 @@
|
|
1
|
+
require File.expand_path('helper', File.dirname(__FILE__))
|
2
|
+
require 'digest/md5'
|
3
|
+
|
4
|
+
class TestAuth < Test::Unit::TestCase
|
5
|
+
include Helper
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super
|
9
|
+
setup_server
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup_server
|
17
|
+
@server = WEBrick::HTTPServer.new(
|
18
|
+
:BindAddress => "localhost",
|
19
|
+
:Logger => @logger,
|
20
|
+
:Port => 0,
|
21
|
+
:AccessLog => [],
|
22
|
+
:DocumentRoot => File.dirname(File.expand_path(__FILE__))
|
23
|
+
)
|
24
|
+
@serverport = @server.config[:Port]
|
25
|
+
@server.mount(
|
26
|
+
'/basic_auth',
|
27
|
+
WEBrick::HTTPServlet::ProcHandler.new(method(:do_basic_auth).to_proc)
|
28
|
+
)
|
29
|
+
@server.mount(
|
30
|
+
'/digest_auth',
|
31
|
+
WEBrick::HTTPServlet::ProcHandler.new(method(:do_digest_auth).to_proc)
|
32
|
+
)
|
33
|
+
@server.mount(
|
34
|
+
'/digest_sess_auth',
|
35
|
+
WEBrick::HTTPServlet::ProcHandler.new(method(:do_digest_sess_auth).to_proc)
|
36
|
+
)
|
37
|
+
htpasswd = File.join(File.dirname(__FILE__), 'htpasswd')
|
38
|
+
htpasswd_userdb = WEBrick::HTTPAuth::Htpasswd.new(htpasswd)
|
39
|
+
htdigest = File.join(File.dirname(__FILE__), 'htdigest')
|
40
|
+
htdigest_userdb = WEBrick::HTTPAuth::Htdigest.new(htdigest)
|
41
|
+
@basic_auth = WEBrick::HTTPAuth::BasicAuth.new(
|
42
|
+
:Logger => @logger,
|
43
|
+
:Realm => 'auth',
|
44
|
+
:UserDB => htpasswd_userdb
|
45
|
+
)
|
46
|
+
@digest_auth = WEBrick::HTTPAuth::DigestAuth.new(
|
47
|
+
:Logger => @logger,
|
48
|
+
:Algorithm => 'MD5',
|
49
|
+
:Realm => 'auth',
|
50
|
+
:UserDB => htdigest_userdb
|
51
|
+
)
|
52
|
+
@digest_sess_auth = WEBrick::HTTPAuth::DigestAuth.new(
|
53
|
+
:Logger => @logger,
|
54
|
+
:Algorithm => 'MD5-sess',
|
55
|
+
:Realm => 'auth',
|
56
|
+
:UserDB => htdigest_userdb
|
57
|
+
)
|
58
|
+
@server_thread = start_server_thread(@server)
|
59
|
+
|
60
|
+
@proxy_digest_auth = WEBrick::HTTPAuth::ProxyDigestAuth.new(
|
61
|
+
:Logger => @proxylogger,
|
62
|
+
:Algorithm => 'MD5',
|
63
|
+
:Realm => 'auth',
|
64
|
+
:UserDB => htdigest_userdb
|
65
|
+
)
|
66
|
+
|
67
|
+
@proxyserver = WEBrick::HTTPProxyServer.new(
|
68
|
+
:ProxyAuthProc => @proxy_digest_auth.method(:authenticate).to_proc,
|
69
|
+
:BindAddress => "localhost",
|
70
|
+
:Logger => @proxylogger,
|
71
|
+
:Port => 0,
|
72
|
+
:AccessLog => []
|
73
|
+
)
|
74
|
+
@proxyport = @proxyserver.config[:Port]
|
75
|
+
@proxyserver_thread = start_server_thread(@proxyserver)
|
76
|
+
end
|
77
|
+
|
78
|
+
def do_basic_auth(req, res)
|
79
|
+
@basic_auth.authenticate(req, res)
|
80
|
+
res['content-type'] = 'text/plain'
|
81
|
+
res.body = 'basic_auth OK'
|
82
|
+
end
|
83
|
+
|
84
|
+
def do_digest_auth(req, res)
|
85
|
+
@digest_auth.authenticate(req, res)
|
86
|
+
res['content-type'] = 'text/plain'
|
87
|
+
res['x-query'] = req.body
|
88
|
+
res.body = 'digest_auth OK' + req.query_string.to_s
|
89
|
+
end
|
90
|
+
|
91
|
+
def do_digest_sess_auth(req, res)
|
92
|
+
@digest_sess_auth.authenticate(req, res)
|
93
|
+
res['content-type'] = 'text/plain'
|
94
|
+
res['x-query'] = req.body
|
95
|
+
res.body = 'digest_sess_auth OK' + req.query_string.to_s
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_basic_auth
|
99
|
+
c = HTTPClient.new
|
100
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
101
|
+
assert_equal('basic_auth OK', c.get_content("http://localhost:#{serverport}/basic_auth"))
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_basic_auth_compat
|
105
|
+
c = HTTPClient.new
|
106
|
+
c.set_basic_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
107
|
+
assert_equal('basic_auth OK', c.get_content("http://localhost:#{serverport}/basic_auth"))
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_BASIC_auth
|
111
|
+
c = HTTPClient.new
|
112
|
+
webrick_backup = @basic_auth.instance_eval { @auth_scheme }
|
113
|
+
#httpaccess2_backup = c.www_auth.basic_auth.instance_eval { @scheme }
|
114
|
+
begin
|
115
|
+
@basic_auth.instance_eval { @auth_scheme = "BASIC" }
|
116
|
+
c.www_auth.basic_auth.instance_eval { @scheme = "BASIC" }
|
117
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
118
|
+
assert_equal('basic_auth OK', c.get_content("http://localhost:#{serverport}/basic_auth"))
|
119
|
+
ensure
|
120
|
+
@basic_auth.instance_eval { @auth_scheme = webrick_backup }
|
121
|
+
#c.www_auth.basic_auth.instance_eval { @scheme = httpaccess2_backup }
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_basic_auth_reuses_credentials
|
126
|
+
c = HTTPClient.new
|
127
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
128
|
+
assert_equal('basic_auth OK', c.get_content("http://localhost:#{serverport}/basic_auth/"))
|
129
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
130
|
+
c.debug_dev = str = ''
|
131
|
+
c.get_content("http://localhost:#{serverport}/basic_auth/sub/dir/")
|
132
|
+
assert_match /Authorization: Basic YWRtaW46YWRtaW4=/, str
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_digest_auth
|
136
|
+
c = HTTPClient.new
|
137
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
138
|
+
assert_equal('digest_auth OK', c.get_content("http://localhost:#{serverport}/digest_auth"))
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_digest_auth_reuses_credentials
|
142
|
+
c = HTTPClient.new
|
143
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
144
|
+
assert_equal('digest_auth OK', c.get_content("http://localhost:#{serverport}/digest_auth/"))
|
145
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
146
|
+
c.debug_dev = str = ''
|
147
|
+
c.get_content("http://localhost:#{serverport}/digest_auth/sub/dir/")
|
148
|
+
assert_match /Authorization: Digest/, str
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_digest_auth_with_block
|
152
|
+
c = HTTPClient.new
|
153
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
154
|
+
called = false
|
155
|
+
c.get_content("http://localhost:#{serverport}/digest_auth") do |str|
|
156
|
+
assert_equal('digest_auth OK', str)
|
157
|
+
called = true
|
158
|
+
end
|
159
|
+
assert(called)
|
160
|
+
#
|
161
|
+
called = false
|
162
|
+
c.get("http://localhost:#{serverport}/digest_auth") do |str|
|
163
|
+
assert_equal('digest_auth OK', str)
|
164
|
+
called = true
|
165
|
+
end
|
166
|
+
assert(called)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_digest_auth_with_post_io
|
170
|
+
c = HTTPClient.new
|
171
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
172
|
+
post_body = StringIO.new("1234567890")
|
173
|
+
assert_equal('1234567890', c.post("http://localhost:#{serverport}/digest_auth", post_body).header['x-query'][0])
|
174
|
+
#
|
175
|
+
post_body = StringIO.new("1234567890")
|
176
|
+
post_body.read(5)
|
177
|
+
assert_equal('67890', c.post("http://localhost:#{serverport}/digest_auth", post_body).header['x-query'][0])
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_digest_auth_with_querystring
|
181
|
+
c = HTTPClient.new
|
182
|
+
c.debug_dev = STDERR if $DEBUG
|
183
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
184
|
+
assert_equal('digest_auth OKbar=baz', c.get_content("http://localhost:#{serverport}/digest_auth/foo?bar=baz"))
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_perfer_digest
|
188
|
+
c = HTTPClient.new
|
189
|
+
c.set_auth('http://example.com/', 'admin', 'admin')
|
190
|
+
c.test_loopback_http_response << "HTTP/1.0 401 Unauthorized\nWWW-Authenticate: Basic realm=\"foo\"\nWWW-Authenticate: Digest realm=\"foo\", nonce=\"nonce\", stale=false\nContent-Length: 2\n\nNG"
|
191
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
192
|
+
c.debug_dev = str = ''
|
193
|
+
c.get_content('http://example.com/')
|
194
|
+
assert_match(/^Authorization: Digest/, str)
|
195
|
+
end
|
196
|
+
|
197
|
+
def test_digest_sess_auth
|
198
|
+
c = HTTPClient.new
|
199
|
+
c.set_auth("http://localhost:#{serverport}/", 'admin', 'admin')
|
200
|
+
assert_equal('digest_sess_auth OK', c.get_content("http://localhost:#{serverport}/digest_sess_auth"))
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_proxy_auth
|
204
|
+
c = HTTPClient.new
|
205
|
+
c.set_proxy_auth('admin', 'admin')
|
206
|
+
c.test_loopback_http_response << "HTTP/1.0 407 Unauthorized\nProxy-Authenticate: Basic realm=\"foo\"\nContent-Length: 2\n\nNG"
|
207
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
208
|
+
c.debug_dev = str = ''
|
209
|
+
c.get_content('http://example.com/')
|
210
|
+
assert_match(/Proxy-Authorization: Basic YWRtaW46YWRtaW4=/, str)
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_proxy_auth_reuses_credentials
|
214
|
+
c = HTTPClient.new
|
215
|
+
c.set_proxy_auth('admin', 'admin')
|
216
|
+
c.test_loopback_http_response << "HTTP/1.0 407 Unauthorized\nProxy-Authenticate: Basic realm=\"foo\"\nContent-Length: 2\n\nNG"
|
217
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
218
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
219
|
+
c.get_content('http://www1.example.com/')
|
220
|
+
c.debug_dev = str = ''
|
221
|
+
c.get_content('http://www2.example.com/')
|
222
|
+
assert_match(/Proxy-Authorization: Basic YWRtaW46YWRtaW4=/, str)
|
223
|
+
end
|
224
|
+
|
225
|
+
def test_digest_proxy_auth_loop
|
226
|
+
c = HTTPClient.new
|
227
|
+
c.set_proxy_auth('admin', 'admin')
|
228
|
+
c.test_loopback_http_response << "HTTP/1.0 407 Unauthorized\nProxy-Authenticate: Digest realm=\"foo\", nonce=\"nonce\", stale=false\nContent-Length: 2\n\nNG"
|
229
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
230
|
+
md5 = Digest::MD5.new
|
231
|
+
ha1 = md5.hexdigest("admin:foo:admin")
|
232
|
+
ha2 = md5.hexdigest("GET:/")
|
233
|
+
response = md5.hexdigest("#{ha1}:nonce:#{ha2}")
|
234
|
+
c.debug_dev = str = ''
|
235
|
+
c.get_content('http://example.com/')
|
236
|
+
assert_match(/Proxy-Authorization: Digest/, str)
|
237
|
+
assert_match(%r"response=\"#{response}\"", str)
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_digest_proxy_auth
|
241
|
+
c=HTTPClient.new("http://localhost:#{proxyport}/")
|
242
|
+
c.set_proxy_auth('admin', 'admin')
|
243
|
+
c.set_auth("http://127.0.0.1:#{serverport}/", 'admin', 'admin')
|
244
|
+
assert_equal('basic_auth OK', c.get_content("http://127.0.0.1:#{serverport}/basic_auth"))
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_digest_proxy_invalid_auth
|
248
|
+
c=HTTPClient.new("http://localhost:#{proxyport}/")
|
249
|
+
c.set_proxy_auth('admin', 'wrong')
|
250
|
+
c.set_auth("http://127.0.0.1:#{serverport}/", 'admin', 'admin')
|
251
|
+
assert_raises(HTTPClient::BadResponseError) do
|
252
|
+
c.get_content("http://127.0.0.1:#{serverport}/basic_auth")
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_prefer_digest_to_basic_proxy_auth
|
257
|
+
c = HTTPClient.new
|
258
|
+
c.set_proxy_auth('admin', 'admin')
|
259
|
+
c.test_loopback_http_response << "HTTP/1.0 407 Unauthorized\nProxy-Authenticate: Digest realm=\"foo\", nonce=\"nonce\", stale=false\nProxy-Authenticate: Basic realm=\"bar\"\nContent-Length: 2\n\nNG"
|
260
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
261
|
+
md5 = Digest::MD5.new
|
262
|
+
ha1 = md5.hexdigest("admin:foo:admin")
|
263
|
+
ha2 = md5.hexdigest("GET:/")
|
264
|
+
response = md5.hexdigest("#{ha1}:nonce:#{ha2}")
|
265
|
+
c.debug_dev = str = ''
|
266
|
+
c.get_content('http://example.com/')
|
267
|
+
assert_match(/Proxy-Authorization: Digest/, str)
|
268
|
+
assert_match(%r"response=\"#{response}\"", str)
|
269
|
+
end
|
270
|
+
|
271
|
+
def test_digest_proxy_auth_reuses_credentials
|
272
|
+
c = HTTPClient.new
|
273
|
+
c.set_proxy_auth('admin', 'admin')
|
274
|
+
c.test_loopback_http_response << "HTTP/1.0 407 Unauthorized\nProxy-Authenticate: Digest realm=\"foo\", nonce=\"nonce\", stale=false\nContent-Length: 2\n\nNG"
|
275
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
276
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
277
|
+
md5 = Digest::MD5.new
|
278
|
+
ha1 = md5.hexdigest("admin:foo:admin")
|
279
|
+
ha2 = md5.hexdigest("GET:/")
|
280
|
+
response = md5.hexdigest("#{ha1}:nonce:#{ha2}")
|
281
|
+
c.get_content('http://www1.example.com/')
|
282
|
+
c.debug_dev = str = ''
|
283
|
+
c.get_content('http://www2.example.com/')
|
284
|
+
assert_match(/Proxy-Authorization: Digest/, str)
|
285
|
+
assert_match(%r"response=\"#{response}\"", str)
|
286
|
+
end
|
287
|
+
|
288
|
+
def test_oauth
|
289
|
+
c = HTTPClient.new
|
290
|
+
config = HTTPClient::OAuth::Config.new(
|
291
|
+
:realm => 'http://photos.example.net/',
|
292
|
+
:consumer_key => 'dpf43f3p2l4k3l03',
|
293
|
+
:consumer_secret => 'kd94hf93k423kf44',
|
294
|
+
:token => 'nnch734d00sl2jdk',
|
295
|
+
:secret => 'pfkkdhi9sl3r4s00',
|
296
|
+
:version => '1.0',
|
297
|
+
:signature_method => 'HMAC-SHA1'
|
298
|
+
)
|
299
|
+
config.debug_timestamp = '1191242096'
|
300
|
+
config.debug_nonce = 'kllo9940pd9333jh'
|
301
|
+
c.www_auth.oauth.set_config('http://photos.example.net/', config)
|
302
|
+
c.www_auth.oauth.challenge('http://photos.example.net/')
|
303
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
304
|
+
c.debug_dev = str = ''
|
305
|
+
c.get_content('http://photos.example.net/photos', [[:file, 'vacation.jpg'], [:size, 'original']])
|
306
|
+
assert(str.index(%q(GET /photos?file=vacation.jpg&size=original)))
|
307
|
+
assert(str.index(%q(Authorization: OAuth realm="http://photos.example.net/", oauth_consumer_key="dpf43f3p2l4k3l03", oauth_nonce="kllo9940pd9333jh", oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_token="nnch734d00sl2jdk", oauth_version="1.0")))
|
308
|
+
#
|
309
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
310
|
+
c.debug_dev = str = ''
|
311
|
+
c.get_content('http://photos.example.net/photos?file=vacation.jpg&size=original')
|
312
|
+
assert(str.index(%q(GET /photos?file=vacation.jpg&size=original)))
|
313
|
+
assert(str.index(%q(Authorization: OAuth realm="http://photos.example.net/", oauth_consumer_key="dpf43f3p2l4k3l03", oauth_nonce="kllo9940pd9333jh", oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_token="nnch734d00sl2jdk", oauth_version="1.0")))
|
314
|
+
#
|
315
|
+
c.test_loopback_http_response << "HTTP/1.0 200 OK\nContent-Length: 2\n\nOK"
|
316
|
+
c.debug_dev = str = ''
|
317
|
+
c.post_content('http://photos.example.net/photos', [[:file, 'vacation.jpg'], [:size, 'original']])
|
318
|
+
assert(str.index(%q(POST /photos)))
|
319
|
+
assert(str.index(%q(Authorization: OAuth realm="http://photos.example.net/", oauth_consumer_key="dpf43f3p2l4k3l03", oauth_nonce="kllo9940pd9333jh", oauth_signature="wPkvxykrw%2BBTdCcGqKr%2B3I%2BPsiM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_token="nnch734d00sl2jdk", oauth_version="1.0")))
|
320
|
+
end
|
321
|
+
end
|