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
@@ -0,0 +1,57 @@
1
+ require 'oauthclient'
2
+ require 'zlib'
3
+ require 'stringio'
4
+
5
+ # Get your own consumer token from http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html
6
+ consumer_key = nil
7
+ consumer_secret = nil
8
+
9
+ callback = 'http://localhost/' # should point somewhere else...
10
+ scope = 'https://www.googleapis.com/auth/buzz'
11
+ request_token_url = 'https://www.google.com/accounts/OAuthGetRequestToken'
12
+ access_token_url = 'https://www.google.com/accounts/OAuthGetAccessToken'
13
+
14
+ STDOUT.sync = true
15
+
16
+ # create OAuth client.
17
+ client = OAuthClient.new
18
+ client.oauth_config.consumer_key = consumer_key
19
+ client.oauth_config.consumer_secret = consumer_secret
20
+ client.oauth_config.signature_method = 'HMAC-SHA1'
21
+ client.oauth_config.http_method = :get # Twitter does not allow :post
22
+ client.debug_dev = STDERR if $DEBUG
23
+
24
+ # Get request token.
25
+ res = client.get_request_token(request_token_url, callback, :scope => scope)
26
+ p res.status
27
+ p res.oauth_params
28
+ p res.content
29
+ p client.oauth_config
30
+ token = res.oauth_params['oauth_token']
31
+ secret = res.oauth_params['oauth_token_secret']
32
+ raise if token.nil? or secret.nil?
33
+
34
+ # You need to confirm authorization out of band.
35
+ puts
36
+ puts "Go here and do confirm: https://www.google.com/buzz/api/auth/OAuthAuthorizeToken?oauth_token=#{token}&domain=#{consumer_key}&scope=#{scope}"
37
+ puts "Type oauth_verifier (if given) and hit [enter] to go"
38
+ require 'cgi'
39
+ verifier = CGI.unescape(gets.chomp)
40
+ verifier = nil if verifier.empty?
41
+
42
+ # Get access token.
43
+ res = client.get_access_token(access_token_url, token, secret, verifier)
44
+ p res.status
45
+ p res.oauth_params
46
+ p res.content
47
+ p client.oauth_config
48
+ id = res.oauth_params['user_id']
49
+
50
+ puts
51
+ puts "Access token usage example"
52
+ puts "Hit [enter] to go"
53
+ gets
54
+
55
+ # Access to a protected resource.
56
+ # @consumption requires Buzz API
57
+ puts client.get_content("https://www.googleapis.com/buzz/v1/activities/@me/@consumption", :alt => :json, :prettyprint => true)
@@ -0,0 +1,59 @@
1
+ require 'oauthclient'
2
+
3
+ # Get your own consumer token from http://friendfeed.com/api/applications
4
+ consumer_key = 'EDIT HERE'
5
+ consumer_secret = 'EDIT HERE'
6
+
7
+ request_token_url = 'https://friendfeed.com/account/oauth/request_token'
8
+ oob_authorize_url = 'https://friendfeed.com/account/oauth/authorize'
9
+ access_token_url = 'https://friendfeed.com/account/oauth/access_token'
10
+
11
+ STDOUT.sync = true
12
+
13
+ # create OAuth client.
14
+ client = OAuthClient.new
15
+ client.oauth_config.consumer_key = consumer_key
16
+ client.oauth_config.consumer_secret = consumer_secret
17
+ client.oauth_config.signature_method = 'HMAC-SHA1'
18
+ client.oauth_config.http_method = :get # FriendFeed does not allow :post
19
+ client.debug_dev = STDERR if $DEBUG
20
+
21
+ # Get request token.
22
+ res = client.get_request_token(request_token_url)
23
+ p res.status
24
+ p res.oauth_params
25
+ p res.content
26
+ p client.oauth_config
27
+ token = res.oauth_params['oauth_token']
28
+ secret = res.oauth_params['oauth_token_secret']
29
+ raise if token.nil? or secret.nil?
30
+
31
+ # You need to confirm authorization out of band.
32
+ puts
33
+ puts "Go here and do confirm: #{oob_authorize_url}?oauth_token=#{token}"
34
+ puts "Hit [enter] to go"
35
+ gets
36
+
37
+ # Get access token.
38
+ # FYI: You may need to re-construct OAuthClient instance here.
39
+ # In normal web app flow, getting access token and getting request token
40
+ # must be done in different HTTP requests.
41
+ # client = OAuthClient.new
42
+ # client.oauth_config.consumer_key = consumer_key
43
+ # client.oauth_config.consumer_secret = consumer_secret
44
+ # client.oauth_config.signature_method = 'HMAC-SHA1'
45
+ # client.oauth_config.http_method = :get # Twitter does not allow :post
46
+ res = client.get_access_token(access_token_url, token, secret)
47
+ p res.status
48
+ p res.oauth_params
49
+ p res.content
50
+ p client.oauth_config
51
+ username = res.oauth_params['username']
52
+
53
+ puts
54
+ puts "Access token usage example"
55
+ puts "Hit [enter] to go"
56
+ gets
57
+
58
+ # Access to a protected resource. (user profile)
59
+ puts client.get("http://friendfeed-api.com/v2/feedinfo/#{username}?format=json")
@@ -0,0 +1,63 @@
1
+ require 'oauthclient'
2
+
3
+ # Get your own consumer token from http://twitter.com/apps
4
+ consumer_key = '3MVG9y6x0357HledNGHa9tJrrlOmpCSo5alTv4W4AG1M0f9a8cGBIwo5wN2bQ7hjAEsjD7SBWf3H2Oycc9Qql'
5
+ consumer_secret = '1404017425765973464'
6
+
7
+ callback = ARGV.shift # can be nil for OAuth 1.0. (not 1.0a)
8
+ request_token_url = 'https://login.salesforce.com/_nc_external/system/security/oauth/RequestTokenHandler'
9
+ oob_authorize_url = 'https://login.salesforce.com/setup/secur/RemoteAccessAuthorizationPage.apexp'
10
+ access_token_url = 'https://login.salesforce.com/_nc_external/system/security/oauth/AccessTokenHandler'
11
+
12
+ STDOUT.sync = true
13
+
14
+ # create OAuth client.
15
+ client = OAuthClient.new
16
+ client.oauth_config.consumer_key = consumer_key
17
+ client.oauth_config.consumer_secret = consumer_secret
18
+ client.oauth_config.signature_method = 'HMAC-SHA1'
19
+ client.oauth_config.http_method = :get # Twitter does not allow :post
20
+ client.debug_dev = STDERR if $DEBUG
21
+
22
+ client.ssl_config.ssl_version = "TLSv1_1"
23
+
24
+ # Get request token.
25
+ res = client.get_request_token(request_token_url, callback)
26
+ p res.status
27
+ p res.oauth_params
28
+ p res.content
29
+ p client.oauth_config
30
+ token = res.oauth_params['oauth_token']
31
+ secret = res.oauth_params['oauth_token_secret']
32
+ raise if token.nil? or secret.nil?
33
+
34
+ # You need to confirm authorization out of band.
35
+ puts
36
+ puts "Go here and do confirm: #{oob_authorize_url}?oauth_token=#{token}&oauth_consumer_key=#{consumer_key}"
37
+ puts "Type oauth_verifier/PIN (if given) and hit [enter] to go"
38
+ verifier = gets.chomp
39
+ verifier = nil if verifier.empty?
40
+
41
+ # Get access token.
42
+ # FYI: You may need to re-construct OAuthClient instance here.
43
+ # In normal web app flow, getting access token and getting request token
44
+ # must be done in different HTTP requests.
45
+ # client = OAuthClient.new
46
+ # client.oauth_config.consumer_key = consumer_key
47
+ # client.oauth_config.consumer_secret = consumer_secret
48
+ # client.oauth_config.signature_method = 'HMAC-SHA1'
49
+ # client.oauth_config.http_method = :get # Twitter does not allow :post
50
+ res = client.get_access_token(access_token_url, token, secret, verifier)
51
+ p res.status
52
+ p res.oauth_params
53
+ p res.content
54
+ p client.oauth_config
55
+ id = res.oauth_params['user_id']
56
+
57
+ puts
58
+ puts "Access token usage example"
59
+ puts "Hit [enter] to go"
60
+ gets
61
+
62
+ # Access to a protected resource. (DM)
63
+ puts client.get("http://twitter.com/direct_messages.json")
@@ -0,0 +1,61 @@
1
+ require 'oauthclient'
2
+
3
+ # Get your own consumer token from http://twitter.com/apps
4
+ consumer_key = 'EDIT HERE'
5
+ consumer_secret = 'EDIT HERE'
6
+
7
+ callback = ARGV.shift # can be nil for OAuth 1.0. (not 1.0a)
8
+ request_token_url = 'http://twitter.com/oauth/request_token'
9
+ oob_authorize_url = 'http://twitter.com/oauth/authorize'
10
+ access_token_url = 'http://twitter.com/oauth/access_token'
11
+
12
+ STDOUT.sync = true
13
+
14
+ # create OAuth client.
15
+ client = OAuthClient.new
16
+ client.oauth_config.consumer_key = consumer_key
17
+ client.oauth_config.consumer_secret = consumer_secret
18
+ client.oauth_config.signature_method = 'HMAC-SHA1'
19
+ client.oauth_config.http_method = :get # Twitter does not allow :post
20
+ client.debug_dev = STDERR if $DEBUG
21
+
22
+ # Get request token.
23
+ res = client.get_request_token(request_token_url, callback)
24
+ p res.status
25
+ p res.oauth_params
26
+ p res.content
27
+ p client.oauth_config
28
+ token = res.oauth_params['oauth_token']
29
+ secret = res.oauth_params['oauth_token_secret']
30
+ raise if token.nil? or secret.nil?
31
+
32
+ # You need to confirm authorization out of band.
33
+ puts
34
+ puts "Go here and do confirm: #{oob_authorize_url}?oauth_token=#{token}"
35
+ puts "Type oauth_verifier/PIN (if given) and hit [enter] to go"
36
+ verifier = gets.chomp
37
+ verifier = nil if verifier.empty?
38
+
39
+ # Get access token.
40
+ # FYI: You may need to re-construct OAuthClient instance here.
41
+ # In normal web app flow, getting access token and getting request token
42
+ # must be done in different HTTP requests.
43
+ # client = OAuthClient.new
44
+ # client.oauth_config.consumer_key = consumer_key
45
+ # client.oauth_config.consumer_secret = consumer_secret
46
+ # client.oauth_config.signature_method = 'HMAC-SHA1'
47
+ # client.oauth_config.http_method = :get # Twitter does not allow :post
48
+ res = client.get_access_token(access_token_url, token, secret, verifier)
49
+ p res.status
50
+ p res.oauth_params
51
+ p res.content
52
+ p client.oauth_config
53
+ id = res.oauth_params['user_id']
54
+
55
+ puts
56
+ puts "Access token usage example"
57
+ puts "Hit [enter] to go"
58
+ gets
59
+
60
+ # Access to a protected resource. (DM)
61
+ puts client.get("http://twitter.com/direct_messages.json")
@@ -0,0 +1,22 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDjzCCAnegAwIBAgIBADANBgkqhkiG9w0BAQUFADAtMQswCQYDVQQGEwJDWjEN
3
+ MAsGA1UEChMEUnVieTEPMA0GA1UEAxMGUnVieUNBMB4XDTAzMDUzMTAyNDcyOFoX
4
+ DTA1MDUzMDAyNDcyOFowLTELMAkGA1UEBhMCQ1oxDTALBgNVBAoTBFJ1YnkxDzAN
5
+ BgNVBAMTBlJ1YnlDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANfw
6
+ JSR2OxME6WBRYekhvN1M7uZwJLC3qHhRtBm583x7MS3yzF/HwFNH1oAmOmzUcDSz
7
+ Y9OmTDVIMU9b0bSYHuu8KswrRWmx/iEhgU/hODS1MQKi+uHoMTtY/dVXwTLAfw5d
8
+ UMPQ9F5EhiV57sKWrS7vIVBtpxUNgfJW61FP+Ru3Lr8uhUgXPECHck8fjFu8w2Sw
9
+ JQBQ8ePrfKBiTHpOzKmDVXXWzVYzIQN0zQfpu/FSjOJ4xWV3wmfltN4FK+UkpALW
10
+ 3RKsNFx+Pmji0fr2/PeEPhzKkhWk5b+pYrIlTNkagS7u8EoeLtY1y3LSZvopbcPI
11
+ l0QFQHCMtxS7ngC6wsECAwEAAaOBuTCBtjAPBgNVHRMECDAGAQH/AgEAMC0GCWCG
12
+ SAGG+EIBDQQgFh5HZW5lcmF0ZWQgYnkgT3BlblNTTCBmb3IgUnVieS4wHQYDVR0O
13
+ BBYEFA2IpXrgDnpJ9p6bfBmtM6j0IejmMFUGA1UdIwROMEyAFA2IpXrgDnpJ9p6b
14
+ fBmtM6j0IejmoTGkLzAtMQswCQYDVQQGEwJDWjENMAsGA1UEChMEUnVieTEPMA0G
15
+ A1UEAxMGUnVieUNBggEAMA0GCS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GyoOXd0W
15
+ qf1CZbrjULT9nfJFWMMicTnLM/6iQx+3bTkXXvk0qP0qAoIPqtY4rwt6yHgq937A
16
+ LubDxudMWV0hqcnH8cBCPHfWdE4HELw4RcVXmQH43yHs1gwShyG9rTS+PCKoRr8u
17
+ bpssW6J0xJmilf1KprbNWJyof9i0CtSVOlUt6ttoinwqj8Me01dHqQ==
18
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,10 @@
1
+ <html>
2
+ <head>
3
+ <title>SSL test</title>
4
+ </head>
5
+ <body>
6
+ <p>
7
+ Verification succeeded?
8
+ </p>
9
+ </body>
10
+ </html>
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift(File.join('..', '..', 'lib'))
4
+ require 'httpclient'
5
+
6
+ url = ARGV.shift || 'https://localhost:8808/'
7
+ uri = URI.parse(url)
8
+
9
+ #ca_file = "0cert.pem"
10
+ #crl_file = '0crl.pem'
11
+
12
+ # create CA's cert in pem format and run 'c_rehash' in trust_certs dir. before
13
+ # using this.
14
+ ca_path = File.join(File.dirname(File.expand_path(__FILE__)), "trust_certs")
15
+
16
+ proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || nil
17
+ h = HTTPClient.new(proxy)
18
+ #h.ssl_config.add_trust_ca(ca_file)
19
+ #h.ssl_config.add_crl(crl_file)
20
+ h.ssl_config.add_trust_ca(ca_path)
21
+
22
+ print h.get_content(url)
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'webrick/https'
4
+ require 'getopts'
5
+
6
+ getopts nil, 'r:', 'p:8808'
7
+
8
+ dir = File::dirname(File::expand_path(__FILE__))
9
+
10
+ # Pass phrase of '1000key.pem' is '1000'.
11
+ data = open(File::join(dir, "1000key.pem")){|io| io.read }
12
+ pkey = OpenSSL::PKey::RSA.new(data)
13
+ data = open(File::join(dir, "1000cert.pem")){|io| io.read }
14
+ cert = OpenSSL::X509::Certificate.new(data)
15
+
16
+ s = WEBrick::HTTPServer.new(
17
+ :BindAddress => "localhost",
18
+ :Port => $OPT_p.to_i,
19
+ :Logger => nil,
20
+ :DocumentRoot => $OPT_r || File::join(dir, "/htdocs"),
21
+ :SSLEnable => true,
22
+ :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
23
+ :SSLCertificate => cert,
24
+ :SSLPrivateKey => pkey,
25
+ :SSLCertName => nil,
26
+ :SSLCACertificateFile => "all.pem"
27
+ )
28
+ trap("INT"){ s.shutdown }
29
+ s.start
@@ -0,0 +1,21 @@
1
+ $:.unshift(File.join('..', 'lib'))
2
+ require "httpclient"
3
+
4
+ c = HTTPClient.new
5
+
6
+ piper, pipew = IO.pipe
7
+ conn = c.post_async("http://localhost:8080/stream", piper)
8
+
9
+ Thread.new do
10
+ res = conn.pop
11
+ while str = res.content.read(10)
12
+ p str
13
+ end
14
+ end
15
+
16
+ p "type here"
17
+ while line = STDIN.gets
18
+ pipew << line
19
+ end
20
+ pipew.close
21
+ sleep 5
@@ -0,0 +1,27 @@
1
+ $:.unshift(File.join('..', 'lib'))
2
+ require 'httpclient'
3
+
4
+ urlstr = ARGV.shift
5
+
6
+ proxy = ENV['HTTP_PROXY'] || ENV['http_proxy']
7
+ h = HTTPClient.new(proxy)
8
+
9
+ count = 20
10
+
11
+ res = []
12
+ g = []
13
+ for i in 0..count
14
+ g << Thread.new {
15
+ res[i] = h.get(urlstr)
16
+ }
17
+ end
18
+
19
+ g.each do |th|
20
+ th.join
21
+ end
22
+
23
+ for i in 0..(count - 1)
24
+ raise unless (res[i].content == res[i + 1].content)
25
+ end
26
+
27
+ puts 'ok'