kronk 1.9.3 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ === 1.9.4 / 2012-09-04
2
+
3
+ * Enhancements:
4
+
5
+ * Support for oauth authentication.
6
+
7
+ * Bugfixes:
8
+
9
+ * Updated Cookie parsing to display correctly when loading from cache.
10
+
1
11
  === 1.9.3 / 2012-07-16
2
12
 
3
13
  * Bugfixes:
@@ -28,7 +28,7 @@ Kronk was made possible by the sponsoring of YP.com.
28
28
 
29
29
  * Launch IRB console with the retrieved response data.
30
30
 
31
- * Support for proxies, ssl, and basic auth.
31
+ * Support for proxies, ssl, oauth, and basic auth.
32
32
 
33
33
  * Cookie/session handling.
34
34
 
data/Rakefile CHANGED
@@ -22,10 +22,11 @@ Hoe.spec 'kronk' do
22
22
  self.history_file = "History.rdoc"
23
23
  self.extra_rdoc_files = FileList['*.rdoc']
24
24
 
25
- self.extra_deps << ['json', '~>1.5']
26
- self.extra_deps << ['cookiejar', '~>0.3.0']
27
- self.extra_deps << ['ruby-path', '~>1.0.0']
28
- self.extra_deps << ['mime-types', '~>1.18.0']
25
+ self.extra_deps << ['json', '~>1.5']
26
+ self.extra_deps << ['cookiejar', '~>0.3.0']
27
+ self.extra_deps << ['ruby-path', '~>1.0.0']
28
+ self.extra_deps << ['mime-types', '~>1.18.0']
29
+ self.extra_deps << ['simple_oauth', '~>0.1.9']
29
30
 
30
31
  self.extra_dev_deps << ['plist', '~>3.1.0']
31
32
  self.extra_dev_deps << ['nokogiri', '~>1.4']
data/TODO.rdoc CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  == Maybe Later
4
4
 
5
+ * Investigate streaming and Yajl.
6
+
5
7
  * Animate Suite player cursor when waiting for input.
6
8
 
7
9
  * Consider getting off of net/http.
@@ -4,17 +4,19 @@ require 'json'
4
4
  require 'cookiejar'
5
5
  require 'path'
6
6
  require 'mime/types'
7
+ require 'simple_oauth'
7
8
 
8
9
  require 'thread'
9
10
  require 'stringio'
10
11
 
11
12
  require 'net/http'
13
+ require 'base64'
12
14
  require 'yaml'
13
15
 
14
16
  class Kronk
15
17
 
16
18
  # This gem's version.
17
- VERSION = '1.9.3'
19
+ VERSION = '1.9.4'
18
20
 
19
21
  require 'kronk/constants'
20
22
  require 'kronk/queue_runner'
@@ -279,6 +281,7 @@ class Kronk
279
281
  # :http_method:: Symbol - the http method to use; defaults to :get
280
282
  # :user_agent:: String - user agent string or alias; defaults to 'kronk'
281
283
  # :auth:: Hash - must contain :username and :password; defaults to nil
284
+ # :oauth:: Hash - :consumer_key, :token, :consumer_secret, :token_secret
282
285
  # :proxy:: Hash/String - http proxy to use; defaults to nil
283
286
  # :keep_indicies:: Boolean - indicies of modified arrays display as hashes
284
287
  # :show_headers:: Boolean/String/Array - which headers to show in output
@@ -389,7 +392,7 @@ class Kronk
389
392
 
390
393
  req = Request.new uri, opts
391
394
  Cmd.verbose "Retrieving URL: #{req.uri}\n" if defined?(Cmd)
392
- resp = req.retrieve opts
395
+ resp = req.stream opts
393
396
 
394
397
  hist_uri = req.uri.to_s[0..-req.uri.request_uri.length]
395
398
  hist_uri = hist_uri[(req.uri.scheme.length + 3)..-1]
@@ -429,7 +432,7 @@ class Kronk
429
432
  out_opts[key] = val.merge out_opts[key], &DEEP_MERGE
430
433
 
431
434
  # Hashes
432
- when :headers, :auth
435
+ when :headers, :auth, :oauth
433
436
  out_opts[key] = val.merge out_opts[key]
434
437
 
435
438
  # Proxy hash or String
@@ -106,7 +106,6 @@ class Kronk
106
106
 
107
107
  def self.parse_args argv
108
108
  options = {
109
- :auth => {},
110
109
  :no_body => false,
111
110
  :player => {},
112
111
  :proxy => {},
@@ -450,6 +449,11 @@ Parse and run diffs against data from live and cached http responses.
450
449
  end
451
450
 
452
451
 
452
+ opt.on('--oauth', String, 'Yaml file with Oauth credentials') do |file|
453
+ options[:oauth] = YAML.load_file file
454
+ end
455
+
456
+
453
457
  opt.on('-x', '--proxy STR', String,
454
458
  'Use HTTP proxy on given port: host[:port]') do |value|
455
459
  options[:proxy][:host], options[:proxy][:port] = value.split ":", 2
@@ -498,6 +502,7 @@ Parse and run diffs against data from live and cached http responses.
498
502
 
499
503
  opt.on('-u', '--user STR', String,
500
504
  'Set server auth user and/or password: usr[:pass]') do |value|
505
+ options[:auth] ||= {}
501
506
  options[:auth][:username], options[:auth][:password] =
502
507
  value.split ":", 2
503
508
 
@@ -679,17 +684,20 @@ Parse and run diffs against data from live and cached http responses.
679
684
  # to $stdout.
680
685
 
681
686
  def self.render kronk, options={}
682
- cache_response kronk.response
687
+ status =
688
+ if options[:irb]
689
+ irb kronk.response
683
690
 
684
- if options[:irb]
685
- irb kronk.response
691
+ elsif kronk.diff
692
+ render_diff kronk.diff
686
693
 
687
- elsif kronk.diff
688
- render_diff kronk.diff
694
+ elsif kronk.response
695
+ render_response kronk.response, kronk.options
696
+ end
689
697
 
690
- elsif kronk.response
691
- render_response kronk.response, kronk.options
692
- end
698
+ cache_response kronk.response
699
+
700
+ status
693
701
  end
694
702
 
695
703
 
@@ -49,9 +49,12 @@ class Kronk
49
49
  Hash === v1 && Hash === v2 ? v1.merge(v2,&DEEP_MERGE) : v2
50
50
  end
51
51
 
52
+ RUBY_ENGINE = 'ruby' unless defined?(RUBY_ENGINE)
53
+
52
54
  # The default Kronk user agent.
53
55
  DEFAULT_USER_AGENT =
54
- "Kronk/#{VERSION} (http://github.com/yaksnrainbows/kronk)"
56
+ "Kronk/#{VERSION} (#{RUBY_PLATFORM}; U; en-US; http://kronk.me) \
57
+ #{RUBY_ENGINE}/#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
55
58
 
56
59
  # Aliases for various user-agents. Thanks Mechanize! :)
57
60
  USER_AGENTS = {
@@ -225,6 +225,7 @@ class Kronk
225
225
  # :query:: Hash/String - the data to append to the http request path
226
226
  # :user_agent:: String - user agent string or alias; defaults to 'kronk'
227
227
  # :auth:: Hash - must contain :username and :password; defaults to nil
228
+ # :oauth:: Hash - :consumer_key, :token, :consumer_secret, :token_secret
228
229
  # :headers:: Hash - extra headers to pass to the request
229
230
  # :http_method:: Symbol - the http method to use; defaults to :get
230
231
  # :proxy:: Hash/String - http proxy to use; defaults to {}
@@ -234,7 +235,8 @@ class Kronk
234
235
  # to using a post request.
235
236
 
236
237
  def initialize uri, opts={}
237
- @auth = opts[:auth]
238
+ @auth = opts[:auth]
239
+ @oauth = opts[:oauth]
238
240
 
239
241
  @connection = nil
240
242
  @response = nil
@@ -283,19 +285,37 @@ class Kronk
283
285
  # Returns the basic auth credentials if available.
284
286
 
285
287
  def auth
286
- @auth ||= Hash.new
288
+ if (!@auth || !@auth[:username]) && @headers['Authorization'] &&
289
+ @headers['Authorization'] !~ /^OAuth\s/
287
290
 
288
- if !@auth[:username] && @headers['Authorization']
289
- require 'base64'
290
291
  str = Base64.decode64 @headers['Authorization'].split[1]
291
292
  username, password = str.split(":", 2)
292
- @auth = {:username => username, :password => password}.merge @auth
293
+ @auth = {
294
+ :username => username,
295
+ :password => password
296
+ }.merge(@auth || {})
293
297
  end
294
298
 
295
299
  @auth
296
300
  end
297
301
 
298
302
 
303
+ ##
304
+ # Returns the oauth credentials if available.
305
+
306
+ def oauth
307
+ if (!@oauth || !@oauth[:token] || !@oauth[:consumer_key]) &&
308
+ @headers['Authorization'].to_s =~ /^OAuth\s/
309
+
310
+ @oauth =
311
+ SimpleOAuth::Header.parse(@headers['Authorization']).
312
+ merge(@oauth || {})
313
+ end
314
+
315
+ @oauth
316
+ end
317
+
318
+
299
319
  ##
300
320
  # Assign request body. Supports String, Hash, and IO. Will attempt to
301
321
  # correctly assing the Content-Type and Transfer-Encoding headers.
@@ -446,7 +466,7 @@ class Kronk
446
466
  def retrieve opts={}, &block
447
467
  start_time = Time.now
448
468
 
449
- @response = stream opts
469
+ @response = stream opts, &block
450
470
 
451
471
  @response.body # make sure to read the full body from io
452
472
  @response.time = Time.now - start_time - @response.conn_time
@@ -466,6 +486,7 @@ class Kronk
466
486
 
467
487
  def stream opts={}, &block
468
488
  retried = false
489
+ opts = opts.merge(:request => self)
469
490
 
470
491
  begin
471
492
  start_time = Time.now
@@ -475,7 +496,6 @@ class Kronk
475
496
 
476
497
  @response = conn.request http_request, nil, opts, &block
477
498
  @response.conn_time = conn_time
478
- @response.request = self
479
499
 
480
500
  @response
481
501
 
@@ -501,8 +521,9 @@ class Kronk
501
521
  :no_cookies => !self.use_cookies
502
522
  }
503
523
 
504
- hash[:auth] = @auth if @auth
505
- hash[:data] = @body if @body
524
+ hash[:auth] = @auth if @auth
525
+ hash[:oauth] = @oauth if @oauth
526
+ hash[:data] = @body if @body
506
527
  hash[:headers] = @headers unless @headers.empty?
507
528
  hash[:proxy] = self.proxy unless self.proxy.empty?
508
529
 
@@ -517,7 +538,7 @@ class Kronk
517
538
 
518
539
  def to_s
519
540
  out = "#{@http_method} #{@uri.request_uri} HTTP/1.1\r\n"
520
- out << "host: #{@uri.host}:#{@uri.port}\r\n"
541
+ out << "Host: #{@uri.host}:#{@uri.port}\r\n"
521
542
 
522
543
  http_request.each do |name, value|
523
544
  out << "#{name}: #{value}\r\n" unless name =~ /host/i
@@ -549,8 +570,12 @@ class Kronk
549
570
  def http_request
550
571
  req = VanillaRequest.new @http_method, @uri.request_uri, @headers
551
572
 
552
- req.basic_auth @auth[:username], @auth[:password] if
553
- @auth && @auth[:username]
573
+ if @oauth
574
+ req['Authorization'] =
575
+ SimpleOAuth::Header.new(@http_method, @uri, {}, self.oauth).to_s
576
+ elsif @auth && @auth[:username]
577
+ req.basic_auth @auth[:username], @auth[:password]
578
+ end
554
579
 
555
580
  # Stream Multipart
556
581
  if Kronk::Multipart === @body
@@ -67,16 +67,22 @@ class Kronk
67
67
 
68
68
  @cookies = []
69
69
 
70
- if URI::HTTP === uri
71
- jar = CookieJar::Jar.new
72
- jar.set_cookies_from_headers uri, @headers
70
+ Array(@headers['set-cookie']).each do |cvalue|
71
+ cookie = CookieJar::CookieValidation.parse_set_cookie(cvalue).to_hash
72
+ cookie.delete :version
73
+ cookie.keys.each{|k| cookie[k.to_s] = cookie.delete(k) }
74
+ @cookies << cookie
75
+ end
73
76
 
74
- jar.to_a.each do |cookie|
75
- @cookies << cookie.to_hash
76
- Kronk.cookie_jar.add_cookie cookie unless opts[:no_cookies]
77
- end
77
+ Array(@headers['set-cookie2']).each do |cvalue|
78
+ cookie = CookieJar::CookieValidation.parse_set_cookie2(cvalue).to_hash
79
+ cookie.keys.each{|k| cookie[k.to_s] = cookie.delete(k) }
80
+ @cookies << cookie
78
81
  end
79
82
 
83
+ Kronk.cookie_jar.set_cookies_from_headers uri, @headers unless
84
+ opts[:no_cookies] || !(URI::HTTP === uri)
85
+
80
86
  self.gzip = opts[:force_gzip]
81
87
  self.inflate = opts[:force_inflate]
82
88
  gzip?
@@ -544,7 +550,7 @@ class Kronk
544
550
 
545
551
  new_opts.merge!(opts)
546
552
 
547
- Request.new(self.location, new_opts).retrieve(new_opts, &block)
553
+ Request.new(self.location, new_opts).stream(new_opts, &block)
548
554
  end
549
555
 
550
556
 
@@ -590,7 +596,7 @@ class Kronk
590
596
  # See Path::Transaction for supported transform actions in the
591
597
  # {ruby-path gem}[http://github.com/yaksnrainbows/ruby-path].
592
598
 
593
- def data opts={}
599
+ def data opts={}, &block
594
600
  data = nil
595
601
 
596
602
  unless opts[:no_body]
@@ -923,29 +929,3 @@ class Kronk
923
929
  end
924
930
  end
925
931
  end
926
-
927
-
928
- class CookieJar::Cookie
929
- def to_hash
930
- result = {
931
- 'name' => @name,
932
- 'value' => @value,
933
- 'domain' => @domain,
934
- 'path' => @path,
935
- }
936
- {
937
- 'expiry' => @expiry,
938
- 'secure' => (true if @secure),
939
- 'http_only' => (true if @http_only),
940
- 'version' => (@version if version != 0),
941
- 'comment' => @comment,
942
- 'comment_url' => @comment_url,
943
- 'discard' => (true if @discard),
944
- 'ports' => @ports
945
- }.each do |name, value|
946
- result[name] = value if value
947
- end
948
-
949
- result
950
- end
951
- end
@@ -196,7 +196,7 @@ def expect_request req_method, url, opts={}
196
196
  with(uri.host, uri.port, {:proxy => proxy, :ssl => !!opts.delete(:ssl)}).
197
197
  returns http
198
198
 
199
- http.expects(:request).with(req, nil, opts).returns resp
199
+ http.expects(:request).with(req, nil, has_entries(opts)).returns resp
200
200
 
201
201
  yield http, req, resp if block_given?
202
202
 
@@ -10,9 +10,9 @@ class TestHelperMethods < Test::Unit::TestCase
10
10
  @mock_resp = Kronk::Response.new io
11
11
  @mock_resp2 = Kronk::Response.new \
12
12
  StringIO.new mock_resp("200_response.json")
13
- @mock_req = stub("mock_req", :retrieve => @mock_resp,
13
+ @mock_req = stub("mock_req", :stream => @mock_resp,
14
14
  :uri => URI.parse("http://host.com"))
15
- @mock_req2 = stub("mock_req", :retrieve => @mock_resp2,
15
+ @mock_req2 = stub("mock_req", :stream => @mock_resp2,
16
16
  :uri => URI.parse("http://host.com"))
17
17
 
18
18
  @mock_thread = stub("mock_thread", :join => true,
@@ -142,7 +142,7 @@ class TestHelperMethods < Test::Unit::TestCase
142
142
 
143
143
  def test_retrieve_unparsable
144
144
  mock_resp = Kronk::Response.new StringIO.new(mock_200_response)
145
- mock_req = stub("mock_req", :retrieve => mock_resp,
145
+ mock_req = stub("mock_req", :stream => mock_resp,
146
146
  :uri => URI.parse("http://host.com"))
147
147
 
148
148
  Kronk::Request.expects(:new).
@@ -163,8 +163,8 @@ class TestHelperMethods < Test::Unit::TestCase
163
163
  def test_retrieve_two_unparsable
164
164
  mock_resp = Kronk::Response.new StringIO.new(mock_200_response)
165
165
 
166
- Kronk::Request.any_instance.expects(:retrieve).returns mock_resp
167
- Kronk::Request.any_instance.expects(:retrieve).returns mock_resp
166
+ Kronk::Request.any_instance.expects(:stream).returns mock_resp
167
+ Kronk::Request.any_instance.expects(:stream).returns mock_resp
168
168
 
169
169
  retrieve "host1.com", "host2.com", :foo => "bar"
170
170
 
@@ -482,7 +482,7 @@ class TestKronk < Test::Unit::TestCase
482
482
  def test_follow_redirect_infinite
483
483
  res = Kronk::Response.new mock_301_response
484
484
  req = Kronk::Request.new "http://www.google.com/"
485
- req.stubs(:retrieve).returns res
485
+ req.stubs(:stream).returns res
486
486
 
487
487
  Kronk::Request.stubs(:new).
488
488
  with("http://www.google.com/",{:follow_redirects => true}).returns req
@@ -501,7 +501,7 @@ class TestKronk < Test::Unit::TestCase
501
501
  def test_num_follow_redirect
502
502
  res = Kronk::Response.new mock_301_response
503
503
  req = Kronk::Request.new "http://www.google.com/"
504
- req.stubs(:retrieve).returns res
504
+ req.stubs(:stream).returns res
505
505
 
506
506
  Kronk::Request.expects(:new).
507
507
  with("http://www.google.com/",{:follow_redirects => 3}).returns(req).
@@ -517,7 +517,7 @@ class TestKronk < Test::Unit::TestCase
517
517
  def test_follow_redirect_no_redirect
518
518
  res = Kronk::Response.new mock_200_response
519
519
  req = Kronk::Request.new "http://www.google.com/"
520
- req.stubs(:retrieve).returns res
520
+ req.stubs(:stream).returns res
521
521
 
522
522
  Kronk::Request.expects(:new).with("http://www.google.com/",{}).never
523
523
  Kronk::Request.expects(:new).
@@ -530,7 +530,7 @@ class TestKronk < Test::Unit::TestCase
530
530
  def test_do_not_follow_redirect
531
531
  res = Kronk::Response.new mock_302_response
532
532
  req = Kronk::Request.new "http://www.google.com/"
533
- req.stubs(:retrieve).returns res
533
+ req.stubs(:stream).returns res
534
534
 
535
535
  Kronk::Request.expects(:new).with("http://www.google.com/",{}).never
536
536
  Kronk::Request.expects(:new).
@@ -392,8 +392,8 @@ class TestPlayer < Test::Unit::TestCase
392
392
  with("beta-example.com", :uri_suffix => '/test', :include_headers => true).
393
393
  returns req2
394
394
 
395
- req1.expects(:retrieve).returns resp1
396
- req2.expects(:retrieve).returns resp2
395
+ req1.expects(:stream).returns resp1
396
+ req2.expects(:stream).returns resp2
397
397
 
398
398
  @got_results = nil
399
399
 
@@ -485,7 +485,7 @@ class TestPlayer < Test::Unit::TestCase
485
485
 
486
486
  req.each_with_index do |r, i|
487
487
  mock_res = Kronk::Response.new resp[i]
488
- mock_req = stub("mock_req", :retrieve => mock_res,
488
+ mock_req = stub("mock_req", :stream => mock_res,
489
489
  :uri => URI.parse("http://host.com"))
490
490
 
491
491
  Kronk::Request.stubs(:new).with(req[i], opts).returns mock_req
@@ -360,6 +360,103 @@ class TestRequest < Test::Unit::TestCase
360
360
  end
361
361
 
362
362
 
363
+ def test_oauth
364
+ oauth = {
365
+ :token => "blah",
366
+ :token_secret => "tsecret",
367
+ :consumer_key => "ckey",
368
+ :consumer_secret => "csecret"
369
+ }
370
+
371
+ req = Kronk::Request.new "foo.com", :oauth => oauth
372
+ auth = req.http_request['Authorization']
373
+
374
+ assert auth =~ /^OAuth\s/,
375
+ ":oauth option should have triggered Authorization header"
376
+
377
+ assert auth =~ / oauth_consumer_key="ckey"/,
378
+ "Authorization should have the consumer key"
379
+ assert auth =~ / oauth_token="blah"/,
380
+ "Authorization should have token"
381
+ end
382
+
383
+
384
+ def test_oauth_basic_auth_collision
385
+ oauth = {
386
+ :token => "blah",
387
+ :token_secret => "tsecret",
388
+ :consumer_key => "ckey",
389
+ :consumer_secret => "csecret"
390
+ }
391
+
392
+ req = Kronk::Request.new "foo.com", :oauth => oauth,
393
+ :auth => {:username => "foo", :password => "bar"}
394
+
395
+ assert_equal({:username => "foo", :password => "bar"}, req.auth)
396
+ assert_equal(oauth, req.oauth)
397
+
398
+ auth = req.http_request['Authorization']
399
+
400
+ assert auth =~ /^OAuth\s/,
401
+ ":oauth option should have triggered Authorization header"
402
+
403
+ assert auth =~ / oauth_consumer_key="ckey"/,
404
+ "Authorization should have the consumer key"
405
+ assert auth =~ / oauth_token="blah"/,
406
+ "Authorization should have token"
407
+ end
408
+
409
+
410
+ def test_oauth_from_headers
411
+ oauth = "OAuth oauth_consumer_key=\"ckey\", \
412
+ oauth_nonce=\"e95a6580533f4b122dc1b67bf28ea320\", \
413
+ oauth_signature=\"NLYgre5962QIYBQFjCQdt5nymBc%3D\", \
414
+ oauth_signature_method=\"HMAC-SHA1\", \
415
+ oauth_timestamp=\"1344556946\", \
416
+ oauth_token=\"blah\", \
417
+ oauth_version=\"1.0\""
418
+
419
+ req = Kronk::Request.new "foo.com", :headers => {'Authorization' => oauth}
420
+ auth = req.http_request['Authorization']
421
+
422
+ assert auth =~ /^OAuth\s/,
423
+ ":oauth option should have triggered Authorization header"
424
+
425
+ assert auth =~ / oauth_consumer_key="ckey"/,
426
+ "Authorization should have the consumer key"
427
+ assert auth =~ / oauth_token="blah"/,
428
+ "Authorization should have token"
429
+ end
430
+
431
+
432
+ def test_oauth_from_headers_and_opts
433
+ oauth = "OAuth oauth_consumer_key=\"ckey\", \
434
+ oauth_nonce=\"e95a6580533f4b122dc1b67bf28ea320\", \
435
+ oauth_signature=\"NLYgre5962QIYBQFjCQdt5nymBc%3D\", \
436
+ oauth_signature_method=\"HMAC-SHA1\", \
437
+ oauth_timestamp=\"1344556946\", \
438
+ oauth_token=\"blah\", \
439
+ oauth_version=\"1.0\""
440
+
441
+ oath_opt = {
442
+ }
443
+
444
+ req = Kronk::Request.new "foo.com/bar",
445
+ :oauth => {:token => "newtoken"},
446
+ :headers => {'Authorization' => oauth}
447
+
448
+ auth = req.http_request['Authorization']
449
+
450
+ assert auth =~ /^OAuth\s/,
451
+ ":oauth option should have triggered Authorization header"
452
+
453
+ assert auth =~ / oauth_consumer_key="ckey"/,
454
+ "Authorization should have the consumer key"
455
+ assert auth =~ / oauth_token="newtoken"/,
456
+ "Authorization should have token"
457
+ end
458
+
459
+
363
460
  def test_auth_from_headers
364
461
  req = Kronk::Request.parse File.read("test/mocks/get_request.txt")
365
462
  assert_equal "bob", req.auth[:username]
@@ -451,8 +548,7 @@ class TestRequest < Test::Unit::TestCase
451
548
  def test_retrieve_user_agent_default
452
549
  expect_request "GET", "http://example.com",
453
550
  :headers => {
454
- 'User-Agent' =>
455
- "Kronk/#{Kronk::VERSION} (http://github.com/yaksnrainbows/kronk)"
551
+ 'User-Agent' => Kronk::DEFAULT_USER_AGENT
456
552
  }
457
553
 
458
554
  Kronk::Request.new("http://example.com").retrieve
@@ -54,11 +54,6 @@ class TestResponse < Test::Unit::TestCase
54
54
  end
55
55
 
56
56
 
57
- def test_init_no_cookies_from_file
58
- assert @html_resp.cookies.empty?
59
- end
60
-
61
-
62
57
  def test_init_cookies
63
58
  Kronk.cookie_jar.expects(:add_cookie).twice
64
59
 
@@ -72,13 +67,13 @@ class TestResponse < Test::Unit::TestCase
72
67
  "ID=99d644506f26d85e:FF=0:TM=1290788168:LM=1290788168:S=VSMemgJxlmlToFA3",
73
68
  "domain"=>".google.com",
74
69
  "path"=>"/",
75
- "expiry"=>Time.parse("2012-11-25 08:16:08 -0800")},
70
+ "expires_at"=>Time.parse("2012-11-25 08:16:08 -0800")},
76
71
  {"name"=>"NID",
77
72
  "value"=>
78
73
  "41=CcmNDE4SfDu5cdTOYVkrCVjlrGO-oVbdo1awh_p8auk2gI4uaX1vNznO0QN8nZH4Mh9WprRy3yI2yd_Fr1WaXVru6Xq3adlSLGUTIRW8SzX58An2nH3D2PhAY5JfcJrl",
79
74
  "domain"=>".google.com",
80
75
  "path"=>"/",
81
- "expiry"=>Time.parse("2011-05-28 09:16:08 -0700"),
76
+ "expires_at"=>Time.parse("2011-05-28 09:16:08 -0700"),
82
77
  "http_only"=>true
83
78
  }]
84
79
 
@@ -101,13 +96,13 @@ class TestResponse < Test::Unit::TestCase
101
96
  "ID=99d644506f26d85e:FF=0:TM=1290788168:LM=1290788168:S=VSMemgJxlmlToFA3",
102
97
  "domain"=>".google.com",
103
98
  "path"=>"/",
104
- "expiry"=>Time.parse("2012-11-25 08:16:08 -0800")},
99
+ "expires_at"=>Time.parse("2012-11-25 08:16:08 -0800")},
105
100
  {"name"=>"NID",
106
101
  "value"=>
107
102
  "41=CcmNDE4SfDu5cdTOYVkrCVjlrGO-oVbdo1awh_p8auk2gI4uaX1vNznO0QN8nZH4Mh9WprRy3yI2yd_Fr1WaXVru6Xq3adlSLGUTIRW8SzX58An2nH3D2PhAY5JfcJrl",
108
103
  "domain"=>".google.com",
109
104
  "path"=>"/",
110
- "expiry"=>Time.parse("2011-05-28 09:16:08 -0700"),
105
+ "expires_at"=>Time.parse("2011-05-28 09:16:08 -0700"),
111
106
  "http_only"=>true
112
107
  }]
113
108
 
metadata CHANGED
@@ -1,182 +1,198 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: kronk
3
- version: !ruby/object:Gem::Version
4
- hash: 53
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.9.4
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 9
9
- - 3
10
- version: 1.9.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeremie Castagna
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-07-16 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: json
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 5
29
- segments:
30
- - 1
31
- - 5
32
- version: "1.5"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.5'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: cookiejar
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
26
+ requirements:
41
27
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 19
44
- segments:
45
- - 0
46
- - 3
47
- - 0
28
+ - !ruby/object:Gem::Version
29
+ version: '1.5'
30
+ - !ruby/object:Gem::Dependency
31
+ name: cookiejar
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
48
37
  version: 0.3.0
49
38
  type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: ruby-path
53
39
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
55
41
  none: false
56
- requirements:
42
+ requirements:
57
43
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 23
60
- segments:
61
- - 1
62
- - 0
63
- - 0
44
+ - !ruby/object:Gem::Version
45
+ version: 0.3.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: ruby-path
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
64
53
  version: 1.0.0
65
54
  type: :runtime
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ - !ruby/object:Gem::Dependency
68
63
  name: mime-types
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.18.0
70
+ type: :runtime
69
71
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
71
73
  none: false
72
- requirements:
74
+ requirements:
73
75
  - - ~>
74
- - !ruby/object:Gem::Version
75
- hash: 95
76
- segments:
77
- - 1
78
- - 18
79
- - 0
76
+ - !ruby/object:Gem::Version
80
77
  version: 1.18.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: simple_oauth
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.1.9
81
86
  type: :runtime
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: rdoc
85
87
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.1.9
94
+ - !ruby/object:Gem::Dependency
95
+ name: rdoc
96
+ requirement: !ruby/object:Gem::Requirement
87
97
  none: false
88
- requirements:
98
+ requirements:
89
99
  - - ~>
90
- - !ruby/object:Gem::Version
91
- hash: 19
92
- segments:
93
- - 3
94
- - 10
95
- version: "3.10"
100
+ - !ruby/object:Gem::Version
101
+ version: '3.10'
96
102
  type: :development
97
- version_requirements: *id005
98
- - !ruby/object:Gem::Dependency
99
- name: plist
100
103
  prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
102
105
  none: false
103
- requirements:
106
+ requirements:
104
107
  - - ~>
105
- - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 3
109
- - 1
110
- - 0
108
+ - !ruby/object:Gem::Version
109
+ version: '3.10'
110
+ - !ruby/object:Gem::Dependency
111
+ name: plist
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
111
117
  version: 3.1.0
112
118
  type: :development
113
- version_requirements: *id006
114
- - !ruby/object:Gem::Dependency
115
- name: nokogiri
116
119
  prerelease: false
117
- requirement: &id007 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
118
121
  none: false
119
- requirements:
122
+ requirements:
120
123
  - - ~>
121
- - !ruby/object:Gem::Version
122
- hash: 7
123
- segments:
124
- - 1
125
- - 4
126
- version: "1.4"
124
+ - !ruby/object:Gem::Version
125
+ version: 3.1.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: nokogiri
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: '1.4'
127
134
  type: :development
128
- version_requirements: *id007
129
- - !ruby/object:Gem::Dependency
130
- name: mocha
131
135
  prerelease: false
132
- requirement: &id008 !ruby/object:Gem::Requirement
136
+ version_requirements: !ruby/object:Gem::Requirement
133
137
  none: false
134
- requirements:
138
+ requirements:
135
139
  - - ~>
136
- - !ruby/object:Gem::Version
137
- hash: 35
138
- segments:
139
- - 0
140
- - 9
141
- - 12
140
+ - !ruby/object:Gem::Version
141
+ version: '1.4'
142
+ - !ruby/object:Gem::Dependency
143
+ name: mocha
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
142
149
  version: 0.9.12
143
150
  type: :development
144
- version_requirements: *id008
145
- - !ruby/object:Gem::Dependency
146
- name: hoe
147
151
  prerelease: false
148
- requirement: &id009 !ruby/object:Gem::Requirement
152
+ version_requirements: !ruby/object:Gem::Requirement
149
153
  none: false
150
- requirements:
154
+ requirements:
151
155
  - - ~>
152
- - !ruby/object:Gem::Version
153
- hash: 7
154
- segments:
155
- - 3
156
- - 0
157
- version: "3.0"
156
+ - !ruby/object:Gem::Version
157
+ version: 0.9.12
158
+ - !ruby/object:Gem::Dependency
159
+ name: hoe
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: '3.0'
158
166
  type: :development
159
- version_requirements: *id009
160
- description: |-
161
- Kronk is a command line swiss-army-knife for HTTP services.
162
-
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: '3.0'
174
+ description: ! 'Kronk is a command line swiss-army-knife for HTTP services.
175
+
176
+
163
177
  With Kronk, you easily parse and segregate data, run diffs between
178
+
164
179
  the parsed data from different queries, and easily replay logs and loadtest
180
+
165
181
  your HTTP applications.
166
-
167
- Kronk was made possible by the sponsoring of YP.com.
168
- email:
182
+
183
+
184
+ Kronk was made possible by the sponsoring of YP.com.'
185
+ email:
169
186
  - yaksnrainbows@gmail.com
170
- executables:
187
+ executables:
171
188
  - kronk
172
189
  extensions: []
173
-
174
- extra_rdoc_files:
190
+ extra_rdoc_files:
175
191
  - History.rdoc
176
192
  - Manifest.txt
177
193
  - README.rdoc
178
194
  - TODO.rdoc
179
- files:
195
+ files:
180
196
  - .autotest
181
197
  - History.rdoc
182
198
  - Manifest.txt
@@ -243,39 +259,31 @@ files:
243
259
  - .gemtest
244
260
  homepage: http://kronk.me
245
261
  licenses: []
246
-
247
262
  post_install_message:
248
- rdoc_options:
263
+ rdoc_options:
249
264
  - --main
250
265
  - README.rdoc
251
- require_paths:
266
+ require_paths:
252
267
  - lib
253
- required_ruby_version: !ruby/object:Gem::Requirement
268
+ required_ruby_version: !ruby/object:Gem::Requirement
254
269
  none: false
255
- requirements:
256
- - - ">="
257
- - !ruby/object:Gem::Version
258
- hash: 3
259
- segments:
260
- - 0
261
- version: "0"
262
- required_rubygems_version: !ruby/object:Gem::Requirement
270
+ requirements:
271
+ - - ! '>='
272
+ - !ruby/object:Gem::Version
273
+ version: '0'
274
+ required_rubygems_version: !ruby/object:Gem::Requirement
263
275
  none: false
264
- requirements:
265
- - - ">="
266
- - !ruby/object:Gem::Version
267
- hash: 3
268
- segments:
269
- - 0
270
- version: "0"
276
+ requirements:
277
+ - - ! '>='
278
+ - !ruby/object:Gem::Version
279
+ version: '0'
271
280
  requirements: []
272
-
273
281
  rubyforge_project: kronk
274
282
  rubygems_version: 1.8.24
275
283
  signing_key:
276
284
  specification_version: 3
277
285
  summary: Kronk is a command line swiss-army-knife for HTTP services
278
- test_files:
286
+ test_files:
279
287
  - test/test_assertions.rb
280
288
  - test/test_cmd.rb
281
289
  - test/test_data_string.rb