curb 0.7.15 → 0.7.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
+ require 'webrick'
3
+ class ::WEBrick::HTTPServer ; def access_log(config, req, res) ; end ; end
4
+ class ::WEBrick::BasicLog ; def log(level, data) ; end ; end
5
+
6
+ class BugCrashOnDebug < Test::Unit::TestCase
7
+
8
+ def test_on_debug
9
+ server = WEBrick::HTTPServer.new( :Port => 9999 )
10
+ server.mount_proc("/test") do|req,res|
11
+ res.body = "hi"
12
+ res['Content-Type'] = "text/html"
13
+ end
14
+
15
+ thread = Thread.new(server) do|srv|
16
+ srv.start
17
+ end
18
+
19
+ c = Curl::Easy.new('http://localhost:9999/test')
20
+ c.on_progress do|x|
21
+ raise "error"
22
+ end
23
+ c.easy.on_debug { |type, data| puts "debug: #{type.inspect}, #{data.inspect}" }
24
+ c.perform
25
+
26
+ rescue => e
27
+ assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s
28
+ c.close
29
+ ensure
30
+ puts "shutdown server"
31
+ server.shutdown
32
+ end
33
+ end
@@ -461,7 +461,8 @@ class TestCurbCurlEasy < Test::Unit::TestCase
461
461
  def test_ssl_verify_host
462
462
  c = Curl::Easy.new
463
463
  assert c.ssl_verify_host?
464
- assert !c.ssl_verify_host = false
464
+ c.ssl_verify_host = 0
465
+ c.ssl_verify_host = false
465
466
  assert !c.ssl_verify_host?
466
467
  end
467
468
 
@@ -507,6 +508,17 @@ class TestCurbCurlEasy < Test::Unit::TestCase
507
508
  assert c.ignore_content_length?
508
509
  end
509
510
 
511
+ def test_resolve_mode
512
+ c = Curl::Easy.new
513
+ assert c.resolve_mode == :auto
514
+ c.resolve_mode = :ipv4
515
+ assert c.resolve_mode == :ipv4
516
+ c.resolve_mode = :ipv6
517
+ assert c.resolve_mode == :ipv6
518
+
519
+ assert_raises(ArgumentError) { c.resolve_mode = :bad }
520
+ end
521
+
510
522
  def test_enable_cookies
511
523
  c = Curl::Easy.new
512
524
  assert !c.enable_cookies?
@@ -572,13 +584,20 @@ class TestCurbCurlEasy < Test::Unit::TestCase
572
584
  def test_post_remote_is_easy_handle
573
585
  # see: http://pastie.org/560852 and
574
586
  # http://groups.google.com/group/curb---ruby-libcurl-bindings/browse_thread/thread/216bb2d9b037f347?hl=en
575
- [:post, :get,:head,:delete].each do |method|
576
- count = 0
577
- curl = Curl::Easy.send("http_#{method}", TestServlet.url) do|c|
578
- count += 1
579
- assert_equal Curl::Easy, c.class
587
+ [:post, :get, :head, :delete].each do |method|
588
+ retries = 0
589
+ begin
590
+ count = 0
591
+ curl = Curl::Easy.send("http_#{method}", TestServlet.url) do|c|
592
+ count += 1
593
+ assert_equal Curl::Easy, c.class
594
+ end
595
+ assert_equal 1, count, "For request method: #{method.to_s.upcase}"
596
+ rescue Curl::Err::HostResolutionError => e # travis-ci.org fails to resolve... try again?
597
+ retries+=1
598
+ retry if retries < 3
599
+ raise e
580
600
  end
581
- assert_equal 1, count, "For request method: #{method.to_s.upcase}"
582
601
  end
583
602
  end
584
603
 
@@ -700,7 +719,9 @@ class TestCurbCurlEasy < Test::Unit::TestCase
700
719
 
701
720
  def test_cert_with_password
702
721
  curl = Curl::Easy.new(TestServlet.url)
703
- curl.cert= File.join(File.dirname(__FILE__),"cert.pem:password")
722
+ path = File.join(File.dirname(__FILE__),"cert.pem")
723
+ curl.certpassword = 'password'
724
+ curl.cert = path
704
725
  assert_match /cert.pem$/,curl.cert
705
726
  end
706
727
 
@@ -888,6 +909,33 @@ class TestCurbCurlEasy < Test::Unit::TestCase
888
909
 
889
910
  end
890
911
 
912
+ def test_get_set_multi_on_easy
913
+ easy = Curl::Easy.new
914
+ assert_nil easy.multi
915
+ multi = Curl::Multi.new
916
+ easy.multi = multi
917
+ assert_not_nil easy.multi
918
+ assert_equal multi, easy.multi
919
+ end
920
+
921
+ def test_handle_exceptions_in_progress_callbacks
922
+ c = Curl::Easy.new($TEST_URL)
923
+ c.on_progress {|x| raise "error" }
924
+ c.perform
925
+ rescue => e
926
+ assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s
927
+ c.close
928
+ end
929
+
930
+ def test_handle_exceptions_in_debug_callbacks
931
+ c = Curl::Easy.new($TEST_URL)
932
+ c.on_debug {|x| raise "error" }
933
+ c.perform
934
+ rescue => e
935
+ assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s
936
+ c.close
937
+ end
938
+
891
939
  include TestServerMethods
892
940
 
893
941
  def setup
@@ -0,0 +1,31 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
+
3
+ class TestCurbCurlEasySetOpt < Test::Unit::TestCase
4
+ def setup
5
+ @easy = Curl::Easy.new
6
+ end
7
+
8
+ def test_opt_verbose
9
+ @easy.set :verbose, true
10
+ assert @easy.verbose?
11
+ end
12
+
13
+ def test_opt_header
14
+ @easy.set :header, true
15
+ end
16
+
17
+ def test_opt_noprogress
18
+ @easy.set :noprogress, true
19
+ end
20
+
21
+ def test_opt_nosignal
22
+ @easy.set :nosignal, true
23
+ end
24
+
25
+ def test_opt_url
26
+ url = "http://google.com/"
27
+ @easy.set :url, url
28
+ assert_equal url, @easy.url
29
+ end
30
+
31
+ end
metadata CHANGED
@@ -1,41 +1,36 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: curb
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.16
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 15
10
- version: 0.7.15
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ross Bamford
14
9
  - Todd A. Fisher
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-03-20 00:00:00 -04:00
20
- default_executable:
13
+ date: 2011-11-03 00:00:00.000000000 Z
21
14
  dependencies: []
22
-
23
- description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings for the libcurl(3), a fully-featured client-side URL transfer library. cURL and libcurl live at http://curl.haxx.se/
15
+ description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
16
+ for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
17
+ libcurl live at http://curl.haxx.se/
24
18
  email: todd.fisher@gmail.com
25
19
  executables: []
26
-
27
- extensions:
20
+ extensions:
28
21
  - ext/extconf.rb
29
- extra_rdoc_files:
22
+ extra_rdoc_files:
30
23
  - LICENSE
31
24
  - README
32
- files:
25
+ files:
33
26
  - LICENSE
34
27
  - README
35
28
  - Rakefile
36
29
  - doc.rb
37
30
  - ext/extconf.rb
38
31
  - lib/curb.rb
32
+ - lib/curl/easy.rb
33
+ - lib/curl/multi.rb
39
34
  - lib/curl.rb
40
35
  - ext/curb.c
41
36
  - ext/curb_easy.c
@@ -51,6 +46,7 @@ files:
51
46
  - ext/curb_postfield.h
52
47
  - ext/curb_upload.h
53
48
  - tests/alltests.rb
49
+ - tests/bug_crash_on_debug.rb
54
50
  - tests/bug_curb_easy_blocks_ruby_threads.rb
55
51
  - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
56
52
  - tests/bug_instance_post_differs_from_class_post.rb
@@ -64,49 +60,42 @@ files:
64
60
  - tests/require_last_or_segfault_script.rb
65
61
  - tests/tc_curl_download.rb
66
62
  - tests/tc_curl_easy.rb
63
+ - tests/tc_curl_easy_setopt.rb
67
64
  - tests/tc_curl_multi.rb
68
65
  - tests/tc_curl_postfield.rb
69
66
  - tests/timeout.rb
70
67
  - tests/timeout_server.rb
71
68
  - tests/unittests.rb
72
- has_rdoc: true
73
69
  homepage: http://curb.rubyforge.org/
74
70
  licenses: []
75
-
76
71
  post_install_message:
77
- rdoc_options:
72
+ rdoc_options:
78
73
  - --main
79
74
  - README
80
- require_paths:
75
+ require_paths:
81
76
  - lib
82
77
  - ext
83
- required_ruby_version: !ruby/object:Gem::Requirement
78
+ required_ruby_version: !ruby/object:Gem::Requirement
84
79
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
92
- required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
85
  none: false
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
- version: "0"
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
101
90
  requirements: []
102
-
103
91
  rubyforge_project: curb
104
- rubygems_version: 1.4.1
92
+ rubygems_version: 1.8.10
105
93
  signing_key:
106
94
  specification_version: 3
107
95
  summary: Ruby libcurl bindings
108
- test_files:
96
+ test_files:
109
97
  - tests/alltests.rb
98
+ - tests/bug_crash_on_debug.rb
110
99
  - tests/bug_curb_easy_blocks_ruby_threads.rb
111
100
  - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
112
101
  - tests/bug_instance_post_differs_from_class_post.rb
@@ -120,6 +109,7 @@ test_files:
120
109
  - tests/require_last_or_segfault_script.rb
121
110
  - tests/tc_curl_download.rb
122
111
  - tests/tc_curl_easy.rb
112
+ - tests/tc_curl_easy_setopt.rb
123
113
  - tests/tc_curl_multi.rb
124
114
  - tests/tc_curl_postfield.rb
125
115
  - tests/timeout.rb