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.
Files changed (251) hide show
  1. data/CHANGELOG.markdown +5 -0
  2. data/lib/scout/command/run.rb +1 -1
  3. data/lib/scout/server.rb +2 -1
  4. data/lib/scout/streamer.rb +3 -2
  5. data/lib/scout/streamer_daemon.rb +4 -4
  6. data/lib/scout/version.rb +1 -1
  7. data/test/scout_test.rb +7 -8
  8. data/vendor/httpclient/README.txt +759 -0
  9. data/vendor/httpclient/bin/httpclient +65 -0
  10. data/vendor/httpclient/lib/hexdump.rb +50 -0
  11. data/vendor/httpclient/lib/http-access2.rb +55 -0
  12. data/vendor/httpclient/lib/http-access2/cookie.rb +1 -0
  13. data/vendor/httpclient/lib/http-access2/http.rb +1 -0
  14. data/vendor/httpclient/lib/httpclient.rb +1156 -0
  15. data/vendor/httpclient/lib/httpclient/auth.rb +899 -0
  16. data/vendor/httpclient/lib/httpclient/cacert.p7s +1912 -0
  17. data/vendor/httpclient/lib/httpclient/connection.rb +88 -0
  18. data/vendor/httpclient/lib/httpclient/cookie.rb +438 -0
  19. data/vendor/httpclient/lib/httpclient/http.rb +1046 -0
  20. data/vendor/httpclient/lib/httpclient/include_client.rb +83 -0
  21. data/vendor/httpclient/lib/httpclient/session.rb +1025 -0
  22. data/vendor/httpclient/lib/httpclient/ssl_config.rb +403 -0
  23. data/vendor/httpclient/lib/httpclient/timeout.rb +140 -0
  24. data/vendor/httpclient/lib/httpclient/util.rb +178 -0
  25. data/vendor/httpclient/lib/httpclient/version.rb +3 -0
  26. data/vendor/httpclient/lib/oauthclient.rb +110 -0
  27. data/vendor/httpclient/sample/async.rb +8 -0
  28. data/vendor/httpclient/sample/auth.rb +11 -0
  29. data/vendor/httpclient/sample/cookie.rb +18 -0
  30. data/vendor/httpclient/sample/dav.rb +103 -0
  31. data/vendor/httpclient/sample/howto.rb +49 -0
  32. data/vendor/httpclient/sample/oauth_buzz.rb +57 -0
  33. data/vendor/httpclient/sample/oauth_friendfeed.rb +59 -0
  34. data/vendor/httpclient/sample/oauth_salesforce_10.rb +63 -0
  35. data/vendor/httpclient/sample/oauth_twitter.rb +61 -0
  36. data/vendor/httpclient/sample/ssl/0cert.pem +22 -0
  37. data/vendor/httpclient/sample/ssl/0key.pem +30 -0
  38. data/vendor/httpclient/sample/ssl/1000cert.pem +19 -0
  39. data/vendor/httpclient/sample/ssl/1000key.pem +18 -0
  40. data/vendor/httpclient/sample/ssl/htdocs/index.html +10 -0
  41. data/vendor/httpclient/sample/ssl/ssl_client.rb +22 -0
  42. data/vendor/httpclient/sample/ssl/webrick_httpsd.rb +29 -0
  43. data/vendor/httpclient/sample/stream.rb +21 -0
  44. data/vendor/httpclient/sample/thread.rb +27 -0
  45. data/vendor/httpclient/sample/wcat.rb +21 -0
  46. data/vendor/httpclient/test/ca-chain.cert +44 -0
  47. data/vendor/httpclient/test/ca.cert +23 -0
  48. data/vendor/httpclient/test/client.cert +19 -0
  49. data/vendor/httpclient/test/client.key +15 -0
  50. data/vendor/httpclient/test/helper.rb +129 -0
  51. data/vendor/httpclient/test/htdigest +1 -0
  52. data/vendor/httpclient/test/htpasswd +2 -0
  53. data/vendor/httpclient/test/runner.rb +2 -0
  54. data/vendor/httpclient/test/server.cert +19 -0
  55. data/vendor/httpclient/test/server.key +15 -0
  56. data/vendor/httpclient/test/sslsvr.rb +65 -0
  57. data/vendor/httpclient/test/subca.cert +21 -0
  58. data/vendor/httpclient/test/test_auth.rb +321 -0
  59. data/vendor/httpclient/test/test_cookie.rb +391 -0
  60. data/vendor/httpclient/test/test_hexdump.rb +14 -0
  61. data/vendor/httpclient/test/test_http-access2.rb +507 -0
  62. data/vendor/httpclient/test/test_httpclient.rb +1783 -0
  63. data/vendor/httpclient/test/test_include_client.rb +52 -0
  64. data/vendor/httpclient/test/test_ssl.rb +235 -0
  65. data/vendor/multi_json/.document +5 -0
  66. data/vendor/multi_json/.rspec +3 -0
  67. data/vendor/multi_json/.travis.yml +11 -0
  68. data/vendor/multi_json/.yardopts +6 -0
  69. data/vendor/multi_json/CHANGELOG.md +169 -0
  70. data/vendor/multi_json/CONTRIBUTING.md +46 -0
  71. data/vendor/multi_json/Gemfile +31 -0
  72. data/vendor/multi_json/LICENSE.md +20 -0
  73. data/vendor/multi_json/README.md +109 -0
  74. data/vendor/multi_json/Rakefile +12 -0
  75. data/vendor/multi_json/lib/multi_json.rb +157 -0
  76. data/vendor/multi_json/lib/multi_json/adapter.rb +48 -0
  77. data/vendor/multi_json/lib/multi_json/adapters/gson.rb +19 -0
  78. data/vendor/multi_json/lib/multi_json/adapters/jr_jackson.rb +19 -0
  79. data/vendor/multi_json/lib/multi_json/adapters/json_common.rb +25 -0
  80. data/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +11 -0
  81. data/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +11 -0
  82. data/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +34 -0
  83. data/vendor/multi_json/lib/multi_json/adapters/oj.rb +24 -0
  84. data/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +22 -0
  85. data/vendor/multi_json/lib/multi_json/adapters/yajl.rb +19 -0
  86. data/vendor/multi_json/lib/multi_json/convertible_hash_keys.rb +43 -0
  87. data/vendor/multi_json/lib/multi_json/load_error.rb +11 -0
  88. data/vendor/multi_json/lib/multi_json/options.rb +48 -0
  89. data/vendor/multi_json/lib/multi_json/vendor/okjson.rb +606 -0
  90. data/vendor/multi_json/lib/multi_json/version.rb +20 -0
  91. data/vendor/multi_json/multi_json.gemspec +22 -0
  92. data/vendor/multi_json/spec/adapter_shared_example.rb +235 -0
  93. data/vendor/multi_json/spec/has_options.rb +119 -0
  94. data/vendor/multi_json/spec/helper.rb +35 -0
  95. data/vendor/multi_json/spec/json_common_shared_example.rb +30 -0
  96. data/vendor/multi_json/spec/multi_json_spec.rb +226 -0
  97. data/vendor/{signature → pusher}/.document +0 -0
  98. data/vendor/{json_pure/diagrams/.keep → pusher/.gemtest} +0 -0
  99. data/vendor/pusher/.gitignore +23 -0
  100. data/vendor/pusher/.travis.yml +15 -0
  101. data/vendor/pusher/Gemfile +2 -0
  102. data/vendor/{pusher-gem → pusher}/LICENSE +1 -1
  103. data/vendor/pusher/README.md +186 -0
  104. data/vendor/{pusher-gem → pusher}/Rakefile +0 -0
  105. data/vendor/{pusher-gem → pusher}/examples/async_message.rb +0 -0
  106. data/vendor/pusher/lib/pusher.rb +60 -0
  107. data/vendor/{pusher-gem → pusher}/lib/pusher/channel.rb +47 -54
  108. data/vendor/pusher/lib/pusher/client.rb +306 -0
  109. data/vendor/pusher/lib/pusher/request.rb +107 -0
  110. data/vendor/pusher/lib/pusher/resource.rb +36 -0
  111. data/vendor/pusher/lib/pusher/webhook.rb +110 -0
  112. data/vendor/{pusher-gem → pusher}/pusher.gemspec +6 -5
  113. data/vendor/pusher/spec/channel_spec.rb +127 -0
  114. data/vendor/pusher/spec/client_spec.rb +464 -0
  115. data/vendor/{pusher-gem → pusher}/spec/spec_helper.rb +12 -0
  116. data/vendor/pusher/spec/web_hook_spec.rb +117 -0
  117. data/vendor/signature/.travis.yml +15 -0
  118. data/vendor/signature/Gemfile +1 -1
  119. data/vendor/signature/README.md +38 -28
  120. data/vendor/signature/lib/signature.rb +97 -15
  121. data/vendor/signature/lib/signature/query_encoder.rb +47 -0
  122. data/vendor/signature/lib/signature/version.rb +1 -1
  123. data/vendor/signature/signature.gemspec +3 -2
  124. data/vendor/signature/spec/signature_spec.rb +164 -55
  125. data/vendor/signature/spec/spec_helper.rb +2 -3
  126. metadata +120 -145
  127. data/vendor/json_pure/.gitignore +0 -12
  128. data/vendor/json_pure/.travis.yml +0 -20
  129. data/vendor/json_pure/CHANGES +0 -282
  130. data/vendor/json_pure/COPYING +0 -58
  131. data/vendor/json_pure/COPYING-json-jruby +0 -57
  132. data/vendor/json_pure/GPL +0 -340
  133. data/vendor/json_pure/Gemfile +0 -11
  134. data/vendor/json_pure/README-json-jruby.markdown +0 -33
  135. data/vendor/json_pure/README.rdoc +0 -358
  136. data/vendor/json_pure/Rakefile +0 -412
  137. data/vendor/json_pure/TODO +0 -1
  138. data/vendor/json_pure/VERSION +0 -1
  139. data/vendor/json_pure/data/example.json +0 -1
  140. data/vendor/json_pure/data/index.html +0 -38
  141. data/vendor/json_pure/data/prototype.js +0 -4184
  142. data/vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h +0 -181
  143. data/vendor/json_pure/ext/json/ext/generator/depend +0 -1
  144. data/vendor/json_pure/ext/json/ext/generator/extconf.rb +0 -14
  145. data/vendor/json_pure/ext/json/ext/generator/generator.c +0 -1435
  146. data/vendor/json_pure/ext/json/ext/generator/generator.h +0 -148
  147. data/vendor/json_pure/ext/json/ext/parser/depend +0 -1
  148. data/vendor/json_pure/ext/json/ext/parser/extconf.rb +0 -13
  149. data/vendor/json_pure/ext/json/ext/parser/parser.c +0 -2204
  150. data/vendor/json_pure/ext/json/ext/parser/parser.h +0 -77
  151. data/vendor/json_pure/ext/json/ext/parser/parser.rl +0 -927
  152. data/vendor/json_pure/install.rb +0 -23
  153. data/vendor/json_pure/java/src/json/ext/ByteListTranscoder.java +0 -167
  154. data/vendor/json_pure/java/src/json/ext/Generator.java +0 -444
  155. data/vendor/json_pure/java/src/json/ext/GeneratorMethods.java +0 -232
  156. data/vendor/json_pure/java/src/json/ext/GeneratorService.java +0 -43
  157. data/vendor/json_pure/java/src/json/ext/GeneratorState.java +0 -543
  158. data/vendor/json_pure/java/src/json/ext/OptionsReader.java +0 -114
  159. data/vendor/json_pure/java/src/json/ext/Parser.java +0 -2644
  160. data/vendor/json_pure/java/src/json/ext/Parser.rl +0 -968
  161. data/vendor/json_pure/java/src/json/ext/ParserService.java +0 -35
  162. data/vendor/json_pure/java/src/json/ext/RuntimeInfo.java +0 -121
  163. data/vendor/json_pure/java/src/json/ext/StringDecoder.java +0 -167
  164. data/vendor/json_pure/java/src/json/ext/StringEncoder.java +0 -106
  165. data/vendor/json_pure/java/src/json/ext/Utils.java +0 -89
  166. data/vendor/json_pure/json-java.gemspec +0 -23
  167. data/vendor/json_pure/json.gemspec +0 -37
  168. data/vendor/json_pure/json_pure.gemspec +0 -39
  169. data/vendor/json_pure/lib/json.rb +0 -62
  170. data/vendor/json_pure/lib/json/add/bigdecimal.rb +0 -28
  171. data/vendor/json_pure/lib/json/add/complex.rb +0 -22
  172. data/vendor/json_pure/lib/json/add/core.rb +0 -11
  173. data/vendor/json_pure/lib/json/add/date.rb +0 -34
  174. data/vendor/json_pure/lib/json/add/date_time.rb +0 -50
  175. data/vendor/json_pure/lib/json/add/exception.rb +0 -31
  176. data/vendor/json_pure/lib/json/add/ostruct.rb +0 -31
  177. data/vendor/json_pure/lib/json/add/range.rb +0 -29
  178. data/vendor/json_pure/lib/json/add/rational.rb +0 -22
  179. data/vendor/json_pure/lib/json/add/regexp.rb +0 -30
  180. data/vendor/json_pure/lib/json/add/struct.rb +0 -30
  181. data/vendor/json_pure/lib/json/add/symbol.rb +0 -25
  182. data/vendor/json_pure/lib/json/add/time.rb +0 -38
  183. data/vendor/json_pure/lib/json/common.rb +0 -487
  184. data/vendor/json_pure/lib/json/ext.rb +0 -21
  185. data/vendor/json_pure/lib/json/ext/.keep +0 -0
  186. data/vendor/json_pure/lib/json/generic_object.rb +0 -70
  187. data/vendor/json_pure/lib/json/pure.rb +0 -21
  188. data/vendor/json_pure/lib/json/pure/generator.rb +0 -522
  189. data/vendor/json_pure/lib/json/pure/parser.rb +0 -359
  190. data/vendor/json_pure/lib/json/version.rb +0 -8
  191. data/vendor/json_pure/tests/fixtures/fail1.json +0 -1
  192. data/vendor/json_pure/tests/fixtures/fail10.json +0 -1
  193. data/vendor/json_pure/tests/fixtures/fail11.json +0 -1
  194. data/vendor/json_pure/tests/fixtures/fail12.json +0 -1
  195. data/vendor/json_pure/tests/fixtures/fail13.json +0 -1
  196. data/vendor/json_pure/tests/fixtures/fail14.json +0 -1
  197. data/vendor/json_pure/tests/fixtures/fail18.json +0 -1
  198. data/vendor/json_pure/tests/fixtures/fail19.json +0 -1
  199. data/vendor/json_pure/tests/fixtures/fail2.json +0 -1
  200. data/vendor/json_pure/tests/fixtures/fail20.json +0 -1
  201. data/vendor/json_pure/tests/fixtures/fail21.json +0 -1
  202. data/vendor/json_pure/tests/fixtures/fail22.json +0 -1
  203. data/vendor/json_pure/tests/fixtures/fail23.json +0 -1
  204. data/vendor/json_pure/tests/fixtures/fail24.json +0 -1
  205. data/vendor/json_pure/tests/fixtures/fail25.json +0 -1
  206. data/vendor/json_pure/tests/fixtures/fail27.json +0 -2
  207. data/vendor/json_pure/tests/fixtures/fail28.json +0 -2
  208. data/vendor/json_pure/tests/fixtures/fail3.json +0 -1
  209. data/vendor/json_pure/tests/fixtures/fail4.json +0 -1
  210. data/vendor/json_pure/tests/fixtures/fail5.json +0 -1
  211. data/vendor/json_pure/tests/fixtures/fail6.json +0 -1
  212. data/vendor/json_pure/tests/fixtures/fail7.json +0 -1
  213. data/vendor/json_pure/tests/fixtures/fail8.json +0 -1
  214. data/vendor/json_pure/tests/fixtures/fail9.json +0 -1
  215. data/vendor/json_pure/tests/fixtures/pass1.json +0 -56
  216. data/vendor/json_pure/tests/fixtures/pass15.json +0 -1
  217. data/vendor/json_pure/tests/fixtures/pass16.json +0 -1
  218. data/vendor/json_pure/tests/fixtures/pass17.json +0 -1
  219. data/vendor/json_pure/tests/fixtures/pass2.json +0 -1
  220. data/vendor/json_pure/tests/fixtures/pass26.json +0 -1
  221. data/vendor/json_pure/tests/fixtures/pass3.json +0 -6
  222. data/vendor/json_pure/tests/setup_variant.rb +0 -11
  223. data/vendor/json_pure/tests/test_json.rb +0 -545
  224. data/vendor/json_pure/tests/test_json_addition.rb +0 -196
  225. data/vendor/json_pure/tests/test_json_encoding.rb +0 -65
  226. data/vendor/json_pure/tests/test_json_fixtures.rb +0 -35
  227. data/vendor/json_pure/tests/test_json_generate.rb +0 -322
  228. data/vendor/json_pure/tests/test_json_generic_object.rb +0 -75
  229. data/vendor/json_pure/tests/test_json_string_matching.rb +0 -39
  230. data/vendor/json_pure/tests/test_json_unicode.rb +0 -72
  231. data/vendor/json_pure/tools/fuzz.rb +0 -139
  232. data/vendor/json_pure/tools/server.rb +0 -62
  233. data/vendor/pusher-gem/Gemfile +0 -2
  234. data/vendor/pusher-gem/README.md +0 -80
  235. data/vendor/pusher-gem/lib/pusher.rb +0 -107
  236. data/vendor/pusher-gem/lib/pusher/request.rb +0 -107
  237. data/vendor/pusher-gem/spec/channel_spec.rb +0 -274
  238. data/vendor/pusher-gem/spec/pusher_spec.rb +0 -87
  239. data/vendor/ruby-hmac/History.txt +0 -15
  240. data/vendor/ruby-hmac/Manifest.txt +0 -11
  241. data/vendor/ruby-hmac/README.md +0 -41
  242. data/vendor/ruby-hmac/Rakefile +0 -23
  243. data/vendor/ruby-hmac/lib/hmac-md5.rb +0 -11
  244. data/vendor/ruby-hmac/lib/hmac-rmd160.rb +0 -11
  245. data/vendor/ruby-hmac/lib/hmac-sha1.rb +0 -11
  246. data/vendor/ruby-hmac/lib/hmac-sha2.rb +0 -25
  247. data/vendor/ruby-hmac/lib/hmac.rb +0 -118
  248. data/vendor/ruby-hmac/lib/ruby_hmac.rb +0 -2
  249. data/vendor/ruby-hmac/ruby-hmac.gemspec +0 -33
  250. data/vendor/ruby-hmac/test/test_hmac.rb +0 -89
  251. data/vendor/signature/VERSION +0 -1
@@ -1,3 +1,3 @@
1
1
  module Signature
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency "ruby-hmac"
21
- s.add_development_dependency "rspec", "~> 2.0.0"
20
+ s.add_dependency "jruby-openssl" if defined?(JRUBY_VERSION)
21
+ s.add_development_dependency "rspec"
22
+ s.add_development_dependency "em-spec"
22
23
  end
@@ -10,72 +10,103 @@ describe Signature do
10
10
  "query" => "params",
11
11
  "go" => "here"
12
12
  })
13
- @signature = @request.sign(@token)[:auth_signature]
14
13
  end
15
14
 
16
- it "should generate base64 encoded signature from correct key" do
17
- @request.send(:string_to_sign).should == "POST\n/some/path\nauth_key=key&auth_timestamp=1234&auth_version=1.0&go=here&query=params"
18
- @signature.should == '3b237953a5ba6619875cbb2a2d43e8da9ef5824e8a2c689f6284ac85bc1ea0db'
19
- end
15
+ describe "generating signatures" do
16
+ before :each do
17
+ @signature = "3b237953a5ba6619875cbb2a2d43e8da9ef5824e8a2c689f6284ac85bc1ea0db"
18
+ end
20
19
 
21
- it "should make auth_hash available after request is signed" do
22
- request = Signature::Request.new('POST', '/some/path', {
23
- "query" => "params"
24
- })
25
- lambda {
26
- request.auth_hash
27
- }.should raise_error('Request not signed')
28
-
29
- request.sign(@token)
30
- request.auth_hash.should == {
31
- :auth_signature => "da078fcedd72941b6c873caa40d0d6b2000ebfc700cee802b128dd20f72e74e9",
32
- :auth_version => "1.0",
33
- :auth_key => "key",
34
- :auth_timestamp => '1234'
35
- }
36
- end
20
+ it "should generate signature correctly" do
21
+ @request.sign(@token)
22
+ string = @request.send(:string_to_sign)
23
+ string.should == "POST\n/some/path\nauth_key=key&auth_timestamp=1234&auth_version=1.0&go=here&query=params"
37
24
 
38
- it "should cope with symbol keys" do
39
- @request.query_hash = {
40
- :query => "params",
41
- :go => "here"
42
- }
43
- @request.sign(@token)[:auth_signature].should == @signature
44
- end
25
+ digest = OpenSSL::Digest::SHA256.new
26
+ signature = OpenSSL::HMAC.hexdigest(digest, @token.secret, string)
27
+ signature.should == @signature
28
+ end
45
29
 
46
- it "should cope with upcase keys (keys are lowercased before signing)" do
47
- @request.query_hash = {
48
- "Query" => "params",
49
- "GO" => "here"
50
- }
51
- @request.sign(@token)[:auth_signature].should == @signature
52
- end
30
+ it "should make auth_hash available after request is signed" do
31
+ @request.query_hash = {
32
+ "query" => "params"
33
+ }
34
+ lambda {
35
+ @request.auth_hash
36
+ }.should raise_error('Request not signed')
53
37
 
54
- it "should use the path to generate signature" do
55
- @request.path = '/some/other/path'
56
- @request.sign(@token)[:auth_signature].should_not == @signature
57
- end
38
+ @request.sign(@token)
39
+ @request.auth_hash.should == {
40
+ :auth_signature => "da078fcedd72941b6c873caa40d0d6b2000ebfc700cee802b128dd20f72e74e9",
41
+ :auth_version => "1.0",
42
+ :auth_key => "key",
43
+ :auth_timestamp => '1234'
44
+ }
45
+ end
58
46
 
59
- it "should use the query string keys to generate signature" do
60
- @request.query_hash = {
61
- "other" => "query"
62
- }
63
- @request.sign(@token)[:auth_signature].should_not == @signature
64
- end
47
+ it "should cope with symbol keys" do
48
+ @request.query_hash = {
49
+ :query => "params",
50
+ :go => "here"
51
+ }
52
+ @request.sign(@token)[:auth_signature].should == @signature
53
+ end
65
54
 
66
- it "should use the query string values to generate signature" do
67
- @request.query_hash = {
68
- "key" => "notfoo",
69
- "other" => 'bar'
70
- }
71
- @request.sign(@token)[:signature].should_not == @signature
55
+ it "should cope with upcase keys (keys are lowercased before signing)" do
56
+ @request.query_hash = {
57
+ "Query" => "params",
58
+ "GO" => "here"
59
+ }
60
+ @request.sign(@token)[:auth_signature].should == @signature
61
+ end
62
+
63
+ it "should generate correct string when query hash contains array" do
64
+ @request.query_hash = {
65
+ "things" => ["thing1", "thing2"]
66
+ }
67
+ @request.send(:string_to_sign).should == "POST\n/some/path\nthings[]=thing1&things[]=thing2"
68
+ end
69
+
70
+ # This may well change in auth version 2
71
+ it "should not escape keys or values in the query string" do
72
+ @request.query_hash = {
73
+ "key;" => "value@"
74
+ }
75
+ @request.send(:string_to_sign).should == "POST\n/some/path\nkey;=value@"
76
+ end
77
+
78
+ it "should cope with requests where the value is nil (antiregression)" do
79
+ @request.query_hash = {
80
+ "key" => nil
81
+ }
82
+ @request.send(:string_to_sign).should == "POST\n/some/path\nkey="
83
+ end
84
+
85
+ it "should use the path to generate signature" do
86
+ @request.path = '/some/other/path'
87
+ @request.sign(@token)[:auth_signature].should_not == @signature
88
+ end
89
+
90
+ it "should use the query string keys to generate signature" do
91
+ @request.query_hash = {
92
+ "other" => "query"
93
+ }
94
+ @request.sign(@token)[:auth_signature].should_not == @signature
95
+ end
96
+
97
+ it "should use the query string values to generate signature" do
98
+ @request.query_hash = {
99
+ "key" => "notfoo",
100
+ "other" => 'bar'
101
+ }
102
+ @request.sign(@token)[:signature].should_not == @signature
103
+ end
72
104
  end
73
105
 
74
106
  describe "verification" do
75
107
  before :each do
76
- Time.stub!(:now).and_return(Time.at(1234))
77
108
  @request.sign(@token)
78
- @params = @request.query_hash.merge(@request.auth_hash)
109
+ @params = @request.signed_params
79
110
  end
80
111
 
81
112
  it "should verify requests" do
@@ -148,6 +179,15 @@ describe Signature do
148
179
  }.should raise_error('Version not supported')
149
180
  end
150
181
 
182
+ it "should validate that the provided token has a non-empty secret" do
183
+ token = Signature::Token.new('key', '')
184
+ request = Signature::Request.new('POST', '/some/path', @params)
185
+
186
+ lambda {
187
+ request.authenticate_by_token!(token)
188
+ }.should raise_error('Provided token is missing secret')
189
+ end
190
+
151
191
  describe "when used with optional block" do
152
192
  it "should optionally take a block which yields the signature" do
153
193
  request = Signature::Request.new('POST', '/some/path', @params)
@@ -162,14 +202,83 @@ describe Signature do
162
202
  request = Signature::Request.new('POST', '/some/path', @params)
163
203
  lambda {
164
204
  request.authenticate { |key| nil }
165
- }.should raise_error('Authentication key required')
205
+ }.should raise_error('Missing parameter: auth_key')
166
206
  end
167
207
 
168
208
  it "should raise error if block returns nil (i.e. key doesn't exist)" do
169
209
  request = Signature::Request.new('POST', '/some/path', @params)
170
210
  lambda {
171
211
  request.authenticate { |key| nil }
172
- }.should raise_error('Invalid authentication key')
212
+ }.should raise_error('Unknown auth_key')
213
+ end
214
+
215
+ it "should raise unless block given" do
216
+ request = Signature::Request.new('POST', '/some/path', @params)
217
+ lambda {
218
+ request.authenticate
219
+ }.should raise_error(ArgumentError, "Block required")
220
+ end
221
+ end
222
+
223
+ describe "authenticate_async" do
224
+ include EM::SpecHelper
225
+ default_timeout 1
226
+
227
+ it "returns a deferrable which succeeds if authentication passes" do
228
+ request = Signature::Request.new('POST', '/some/path', @params)
229
+ em {
230
+ df = EM::DefaultDeferrable.new
231
+
232
+ request_df = request.authenticate_async do |key|
233
+ df
234
+ end
235
+
236
+ df.succeed(@token)
237
+
238
+ request_df.callback { |token|
239
+ token.should == @token
240
+ done
241
+ }
242
+ }
243
+ end
244
+
245
+ it "returns a deferrable which fails if block df fails" do
246
+ request = Signature::Request.new('POST', '/some/path', @params)
247
+ em {
248
+ df = EM::DefaultDeferrable.new
249
+
250
+ request_df = request.authenticate_async do |key|
251
+ df
252
+ end
253
+
254
+ df.fail()
255
+
256
+ request_df.errback { |e|
257
+ e.class.should == Signature::AuthenticationError
258
+ e.message.should == 'Unknown auth_key'
259
+ done
260
+ }
261
+ }
262
+ end
263
+
264
+ it "returns a deferrable which fails if request does not validate" do
265
+ request = Signature::Request.new('POST', '/some/path', @params)
266
+ em {
267
+ df = EM::DefaultDeferrable.new
268
+
269
+ request_df = request.authenticate_async do |key|
270
+ df
271
+ end
272
+
273
+ token = Signature::Token.new('key', 'wrong_secret')
274
+ df.succeed(token)
275
+
276
+ request_df.errback { |e|
277
+ e.class.should == Signature::AuthenticationError
278
+ e.message.should =~ /Invalid signature/
279
+ done
280
+ }
281
+ }
173
282
  end
174
283
  end
175
284
  end
@@ -1,9 +1,8 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
-
4
- require 'rubygems'
5
2
  require 'signature'
3
+
6
4
  require 'rspec'
5
+ require 'em-spec/rspec'
7
6
 
8
7
  RSpec.configure do |config|
9
8
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.1
5
- prerelease:
4
+ version: 5.7.2.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andre Lewis
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-08-26 00:00:00.000000000 Z
14
+ date: 2013-09-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: elif
@@ -71,145 +71,123 @@ files:
71
71
  - scout.gemspec
72
72
  - test/plugins/disk_usage.rb
73
73
  - test/scout_test.rb
74
- - vendor/json_pure/.gitignore
75
- - vendor/json_pure/.travis.yml
76
- - vendor/json_pure/CHANGES
77
- - vendor/json_pure/COPYING
78
- - vendor/json_pure/COPYING-json-jruby
79
- - vendor/json_pure/GPL
80
- - vendor/json_pure/Gemfile
81
- - vendor/json_pure/README-json-jruby.markdown
82
- - vendor/json_pure/README.rdoc
83
- - vendor/json_pure/Rakefile
84
- - vendor/json_pure/TODO
85
- - vendor/json_pure/VERSION
86
- - vendor/json_pure/data/example.json
87
- - vendor/json_pure/data/index.html
88
- - vendor/json_pure/data/prototype.js
89
- - vendor/json_pure/diagrams/.keep
90
- - vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h
91
- - vendor/json_pure/ext/json/ext/generator/depend
92
- - vendor/json_pure/ext/json/ext/generator/extconf.rb
93
- - vendor/json_pure/ext/json/ext/generator/generator.c
94
- - vendor/json_pure/ext/json/ext/generator/generator.h
95
- - vendor/json_pure/ext/json/ext/parser/depend
96
- - vendor/json_pure/ext/json/ext/parser/extconf.rb
97
- - vendor/json_pure/ext/json/ext/parser/parser.c
98
- - vendor/json_pure/ext/json/ext/parser/parser.h
99
- - vendor/json_pure/ext/json/ext/parser/parser.rl
100
- - vendor/json_pure/install.rb
101
- - vendor/json_pure/java/src/json/ext/ByteListTranscoder.java
102
- - vendor/json_pure/java/src/json/ext/Generator.java
103
- - vendor/json_pure/java/src/json/ext/GeneratorMethods.java
104
- - vendor/json_pure/java/src/json/ext/GeneratorService.java
105
- - vendor/json_pure/java/src/json/ext/GeneratorState.java
106
- - vendor/json_pure/java/src/json/ext/OptionsReader.java
107
- - vendor/json_pure/java/src/json/ext/Parser.java
108
- - vendor/json_pure/java/src/json/ext/Parser.rl
109
- - vendor/json_pure/java/src/json/ext/ParserService.java
110
- - vendor/json_pure/java/src/json/ext/RuntimeInfo.java
111
- - vendor/json_pure/java/src/json/ext/StringDecoder.java
112
- - vendor/json_pure/java/src/json/ext/StringEncoder.java
113
- - vendor/json_pure/java/src/json/ext/Utils.java
114
- - vendor/json_pure/json-java.gemspec
115
- - vendor/json_pure/json.gemspec
116
- - vendor/json_pure/json_pure.gemspec
117
- - vendor/json_pure/lib/json.rb
118
- - vendor/json_pure/lib/json/add/bigdecimal.rb
119
- - vendor/json_pure/lib/json/add/complex.rb
120
- - vendor/json_pure/lib/json/add/core.rb
121
- - vendor/json_pure/lib/json/add/date.rb
122
- - vendor/json_pure/lib/json/add/date_time.rb
123
- - vendor/json_pure/lib/json/add/exception.rb
124
- - vendor/json_pure/lib/json/add/ostruct.rb
125
- - vendor/json_pure/lib/json/add/range.rb
126
- - vendor/json_pure/lib/json/add/rational.rb
127
- - vendor/json_pure/lib/json/add/regexp.rb
128
- - vendor/json_pure/lib/json/add/struct.rb
129
- - vendor/json_pure/lib/json/add/symbol.rb
130
- - vendor/json_pure/lib/json/add/time.rb
131
- - vendor/json_pure/lib/json/common.rb
132
- - vendor/json_pure/lib/json/ext.rb
133
- - vendor/json_pure/lib/json/ext/.keep
134
- - vendor/json_pure/lib/json/generic_object.rb
135
- - vendor/json_pure/lib/json/pure.rb
136
- - vendor/json_pure/lib/json/pure/generator.rb
137
- - vendor/json_pure/lib/json/pure/parser.rb
138
- - vendor/json_pure/lib/json/version.rb
139
- - vendor/json_pure/tests/fixtures/fail1.json
140
- - vendor/json_pure/tests/fixtures/fail10.json
141
- - vendor/json_pure/tests/fixtures/fail11.json
142
- - vendor/json_pure/tests/fixtures/fail12.json
143
- - vendor/json_pure/tests/fixtures/fail13.json
144
- - vendor/json_pure/tests/fixtures/fail14.json
145
- - vendor/json_pure/tests/fixtures/fail18.json
146
- - vendor/json_pure/tests/fixtures/fail19.json
147
- - vendor/json_pure/tests/fixtures/fail2.json
148
- - vendor/json_pure/tests/fixtures/fail20.json
149
- - vendor/json_pure/tests/fixtures/fail21.json
150
- - vendor/json_pure/tests/fixtures/fail22.json
151
- - vendor/json_pure/tests/fixtures/fail23.json
152
- - vendor/json_pure/tests/fixtures/fail24.json
153
- - vendor/json_pure/tests/fixtures/fail25.json
154
- - vendor/json_pure/tests/fixtures/fail27.json
155
- - vendor/json_pure/tests/fixtures/fail28.json
156
- - vendor/json_pure/tests/fixtures/fail3.json
157
- - vendor/json_pure/tests/fixtures/fail4.json
158
- - vendor/json_pure/tests/fixtures/fail5.json
159
- - vendor/json_pure/tests/fixtures/fail6.json
160
- - vendor/json_pure/tests/fixtures/fail7.json
161
- - vendor/json_pure/tests/fixtures/fail8.json
162
- - vendor/json_pure/tests/fixtures/fail9.json
163
- - vendor/json_pure/tests/fixtures/pass1.json
164
- - vendor/json_pure/tests/fixtures/pass15.json
165
- - vendor/json_pure/tests/fixtures/pass16.json
166
- - vendor/json_pure/tests/fixtures/pass17.json
167
- - vendor/json_pure/tests/fixtures/pass2.json
168
- - vendor/json_pure/tests/fixtures/pass26.json
169
- - vendor/json_pure/tests/fixtures/pass3.json
170
- - vendor/json_pure/tests/setup_variant.rb
171
- - vendor/json_pure/tests/test_json.rb
172
- - vendor/json_pure/tests/test_json_addition.rb
173
- - vendor/json_pure/tests/test_json_encoding.rb
174
- - vendor/json_pure/tests/test_json_fixtures.rb
175
- - vendor/json_pure/tests/test_json_generate.rb
176
- - vendor/json_pure/tests/test_json_generic_object.rb
177
- - vendor/json_pure/tests/test_json_string_matching.rb
178
- - vendor/json_pure/tests/test_json_unicode.rb
179
- - vendor/json_pure/tools/fuzz.rb
180
- - vendor/json_pure/tools/server.rb
181
- - vendor/pusher-gem/Gemfile
182
- - vendor/pusher-gem/LICENSE
183
- - vendor/pusher-gem/README.md
184
- - vendor/pusher-gem/Rakefile
185
- - vendor/pusher-gem/examples/async_message.rb
186
- - vendor/pusher-gem/lib/pusher.rb
187
- - vendor/pusher-gem/lib/pusher/channel.rb
188
- - vendor/pusher-gem/lib/pusher/request.rb
189
- - vendor/pusher-gem/pusher.gemspec
190
- - vendor/pusher-gem/spec/channel_spec.rb
191
- - vendor/pusher-gem/spec/pusher_spec.rb
192
- - vendor/pusher-gem/spec/spec_helper.rb
193
- - vendor/ruby-hmac/History.txt
194
- - vendor/ruby-hmac/Manifest.txt
195
- - vendor/ruby-hmac/README.md
196
- - vendor/ruby-hmac/Rakefile
197
- - vendor/ruby-hmac/lib/hmac-md5.rb
198
- - vendor/ruby-hmac/lib/hmac-rmd160.rb
199
- - vendor/ruby-hmac/lib/hmac-sha1.rb
200
- - vendor/ruby-hmac/lib/hmac-sha2.rb
201
- - vendor/ruby-hmac/lib/hmac.rb
202
- - vendor/ruby-hmac/lib/ruby_hmac.rb
203
- - vendor/ruby-hmac/ruby-hmac.gemspec
204
- - vendor/ruby-hmac/test/test_hmac.rb
205
- - vendor/signature/.document
74
+ - vendor/httpclient/README.txt
75
+ - vendor/httpclient/bin/httpclient
76
+ - vendor/httpclient/lib/hexdump.rb
77
+ - vendor/httpclient/lib/http-access2.rb
78
+ - vendor/httpclient/lib/http-access2/cookie.rb
79
+ - vendor/httpclient/lib/http-access2/http.rb
80
+ - vendor/httpclient/lib/httpclient.rb
81
+ - vendor/httpclient/lib/httpclient/auth.rb
82
+ - vendor/httpclient/lib/httpclient/cacert.p7s
83
+ - vendor/httpclient/lib/httpclient/connection.rb
84
+ - vendor/httpclient/lib/httpclient/cookie.rb
85
+ - vendor/httpclient/lib/httpclient/http.rb
86
+ - vendor/httpclient/lib/httpclient/include_client.rb
87
+ - vendor/httpclient/lib/httpclient/session.rb
88
+ - vendor/httpclient/lib/httpclient/ssl_config.rb
89
+ - vendor/httpclient/lib/httpclient/timeout.rb
90
+ - vendor/httpclient/lib/httpclient/util.rb
91
+ - vendor/httpclient/lib/httpclient/version.rb
92
+ - vendor/httpclient/lib/oauthclient.rb
93
+ - vendor/httpclient/sample/async.rb
94
+ - vendor/httpclient/sample/auth.rb
95
+ - vendor/httpclient/sample/cookie.rb
96
+ - vendor/httpclient/sample/dav.rb
97
+ - vendor/httpclient/sample/howto.rb
98
+ - vendor/httpclient/sample/oauth_buzz.rb
99
+ - vendor/httpclient/sample/oauth_friendfeed.rb
100
+ - vendor/httpclient/sample/oauth_salesforce_10.rb
101
+ - vendor/httpclient/sample/oauth_twitter.rb
102
+ - vendor/httpclient/sample/ssl/0cert.pem
103
+ - vendor/httpclient/sample/ssl/0key.pem
104
+ - vendor/httpclient/sample/ssl/1000cert.pem
105
+ - vendor/httpclient/sample/ssl/1000key.pem
106
+ - vendor/httpclient/sample/ssl/htdocs/index.html
107
+ - vendor/httpclient/sample/ssl/ssl_client.rb
108
+ - vendor/httpclient/sample/ssl/webrick_httpsd.rb
109
+ - vendor/httpclient/sample/stream.rb
110
+ - vendor/httpclient/sample/thread.rb
111
+ - vendor/httpclient/sample/wcat.rb
112
+ - vendor/httpclient/test/ca-chain.cert
113
+ - vendor/httpclient/test/ca.cert
114
+ - vendor/httpclient/test/client.cert
115
+ - vendor/httpclient/test/client.key
116
+ - vendor/httpclient/test/helper.rb
117
+ - vendor/httpclient/test/htdigest
118
+ - vendor/httpclient/test/htpasswd
119
+ - vendor/httpclient/test/runner.rb
120
+ - vendor/httpclient/test/server.cert
121
+ - vendor/httpclient/test/server.key
122
+ - vendor/httpclient/test/sslsvr.rb
123
+ - vendor/httpclient/test/subca.cert
124
+ - vendor/httpclient/test/test_auth.rb
125
+ - vendor/httpclient/test/test_cookie.rb
126
+ - vendor/httpclient/test/test_hexdump.rb
127
+ - vendor/httpclient/test/test_http-access2.rb
128
+ - vendor/httpclient/test/test_httpclient.rb
129
+ - vendor/httpclient/test/test_include_client.rb
130
+ - vendor/httpclient/test/test_ssl.rb
131
+ - vendor/multi_json/.document
132
+ - vendor/multi_json/.rspec
133
+ - vendor/multi_json/.travis.yml
134
+ - vendor/multi_json/.yardopts
135
+ - vendor/multi_json/CHANGELOG.md
136
+ - vendor/multi_json/CONTRIBUTING.md
137
+ - vendor/multi_json/Gemfile
138
+ - vendor/multi_json/LICENSE.md
139
+ - vendor/multi_json/README.md
140
+ - vendor/multi_json/Rakefile
141
+ - vendor/multi_json/lib/multi_json.rb
142
+ - vendor/multi_json/lib/multi_json/adapter.rb
143
+ - vendor/multi_json/lib/multi_json/adapters/gson.rb
144
+ - vendor/multi_json/lib/multi_json/adapters/jr_jackson.rb
145
+ - vendor/multi_json/lib/multi_json/adapters/json_common.rb
146
+ - vendor/multi_json/lib/multi_json/adapters/json_gem.rb
147
+ - vendor/multi_json/lib/multi_json/adapters/json_pure.rb
148
+ - vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb
149
+ - vendor/multi_json/lib/multi_json/adapters/oj.rb
150
+ - vendor/multi_json/lib/multi_json/adapters/ok_json.rb
151
+ - vendor/multi_json/lib/multi_json/adapters/yajl.rb
152
+ - vendor/multi_json/lib/multi_json/convertible_hash_keys.rb
153
+ - vendor/multi_json/lib/multi_json/load_error.rb
154
+ - vendor/multi_json/lib/multi_json/options.rb
155
+ - vendor/multi_json/lib/multi_json/vendor/okjson.rb
156
+ - vendor/multi_json/lib/multi_json/version.rb
157
+ - vendor/multi_json/multi_json.gemspec
158
+ - vendor/multi_json/spec/adapter_shared_example.rb
159
+ - vendor/multi_json/spec/has_options.rb
160
+ - vendor/multi_json/spec/helper.rb
161
+ - vendor/multi_json/spec/json_common_shared_example.rb
162
+ - vendor/multi_json/spec/multi_json_spec.rb
163
+ - vendor/pusher/.document
164
+ - vendor/pusher/.gemtest
165
+ - vendor/pusher/.gitignore
166
+ - vendor/pusher/.travis.yml
167
+ - vendor/pusher/Gemfile
168
+ - vendor/pusher/LICENSE
169
+ - vendor/pusher/README.md
170
+ - vendor/pusher/Rakefile
171
+ - vendor/pusher/examples/async_message.rb
172
+ - vendor/pusher/lib/pusher.rb
173
+ - vendor/pusher/lib/pusher/channel.rb
174
+ - vendor/pusher/lib/pusher/client.rb
175
+ - vendor/pusher/lib/pusher/request.rb
176
+ - vendor/pusher/lib/pusher/resource.rb
177
+ - vendor/pusher/lib/pusher/webhook.rb
178
+ - vendor/pusher/pusher.gemspec
179
+ - vendor/pusher/spec/channel_spec.rb
180
+ - vendor/pusher/spec/client_spec.rb
181
+ - vendor/pusher/spec/spec_helper.rb
182
+ - vendor/pusher/spec/web_hook_spec.rb
206
183
  - vendor/signature/.gitignore
184
+ - vendor/signature/.travis.yml
207
185
  - vendor/signature/Gemfile
208
186
  - vendor/signature/LICENSE
209
187
  - vendor/signature/README.md
210
188
  - vendor/signature/Rakefile
211
- - vendor/signature/VERSION
212
189
  - vendor/signature/lib/signature.rb
190
+ - vendor/signature/lib/signature/query_encoder.rb
213
191
  - vendor/signature/lib/signature/version.rb
214
192
  - vendor/signature/signature.gemspec
215
193
  - vendor/signature/spec/signature_spec.rb
@@ -227,18 +205,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
205
  - - ! '>='
228
206
  - !ruby/object:Gem::Version
229
207
  version: '0'
230
- segments:
231
- - 0
232
- hash: -2051011438505824188
233
208
  required_rubygems_version: !ruby/object:Gem::Requirement
234
209
  none: false
235
210
  requirements:
236
- - - ! '>='
211
+ - - ! '>'
237
212
  - !ruby/object:Gem::Version
238
- version: '0'
239
- segments:
240
- - 0
241
- hash: -2051011438505824188
213
+ version: 1.3.1
242
214
  requirements: []
243
215
  rubyforge_project: scout
244
216
  rubygems_version: 1.8.25
@@ -247,4 +219,7 @@ specification_version: 3
247
219
  summary: Scout is an easy-to-use hosted server monitoring service. The scout Ruby
248
220
  gem reports metrics to our service. The agent runs plugins, configured via the Scout
249
221
  web interface, to monitor a server.
250
- test_files: []
222
+ test_files:
223
+ - test/plugins/disk_usage.rb
224
+ - test/scout_test.rb
225
+ has_rdoc: