curb 0.9.8 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +69 -7
- data/Rakefile +18 -19
- data/ext/banned.h +32 -0
- data/ext/curb.c +164 -8
- data/ext/curb.h +18 -5
- data/ext/curb_easy.c +134 -44
- data/ext/curb_easy.h +3 -0
- data/ext/curb_macros.h +12 -0
- data/ext/curb_multi.c +50 -24
- data/ext/curb_postfield.c +9 -7
- data/ext/curb_upload.c +1 -0
- data/ext/extconf.rb +45 -0
- data/lib/curb.rb +1 -0
- data/lib/curl/easy.rb +14 -7
- data/lib/curl/multi.rb +11 -3
- data/lib/curl.rb +12 -3
- data/tests/bug_crash_on_debug.rb +14 -28
- data/tests/bug_crash_on_progress.rb +7 -31
- data/tests/bug_curb_easy_blocks_ruby_threads.rb +8 -13
- data/tests/bug_curb_easy_post_with_string_no_content_length_header.rb +6 -30
- data/tests/bug_follow_redirect_288.rb +83 -0
- data/tests/bug_instance_post_differs_from_class_post.rb +3 -5
- data/tests/bug_issue277.rb +32 -0
- data/tests/bug_multi_segfault.rb +1 -0
- data/tests/bug_raise_on_callback.rb +29 -0
- data/tests/helper.rb +27 -1
- data/tests/tc_curl_easy.rb +72 -4
- data/tests/tc_curl_maxfilesize.rb +12 -0
- data/tests/tc_curl_multi.rb +98 -16
- data/tests/tc_curl_postfield.rb +29 -29
- data/tests/tc_curl_protocols.rb +37 -0
- data/tests/timeout.rb +21 -5
- metadata +37 -27
@@ -0,0 +1,37 @@
|
|
1
|
+
class TestCurbCurlProtocols < Test::Unit::TestCase
|
2
|
+
include TestServerMethods
|
3
|
+
|
4
|
+
def setup
|
5
|
+
@easy = Curl::Easy.new
|
6
|
+
@easy.set :protocols, Curl::CURLPROTO_HTTP | Curl::CURLPROTO_HTTPS
|
7
|
+
@easy.follow_location = true
|
8
|
+
server_setup
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_protocol_allowed
|
12
|
+
@easy.set :url, "http://127.0.0.1:9129/this_file_does_not_exist.html"
|
13
|
+
@easy.perform
|
14
|
+
assert_equal 404, @easy.response_code
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_protocol_denied
|
18
|
+
@easy.set :url, "gopher://google.com/"
|
19
|
+
assert_raises Curl::Err::UnsupportedProtocolError do
|
20
|
+
@easy.perform
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_redir_protocol_allowed
|
25
|
+
@easy.set :url, TestServlet.url + "/redirect"
|
26
|
+
@easy.set :redir_protocols, Curl::CURLPROTO_HTTP
|
27
|
+
@easy.perform
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_redir_protocol_denied
|
31
|
+
@easy.set :url, TestServlet.url + "/redirect"
|
32
|
+
@easy.set :redir_protocols, Curl::CURLPROTO_HTTPS
|
33
|
+
assert_raises Curl::Err::UnsupportedProtocolError do
|
34
|
+
@easy.perform
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/tests/timeout.rb
CHANGED
@@ -17,9 +17,13 @@ class TestCurbTimeouts < Test::Unit::TestCase
|
|
17
17
|
def test_overall_timeout_on_dead_transfer
|
18
18
|
curl = Curl::Easy.new(wait_url(2))
|
19
19
|
curl.timeout = 1
|
20
|
-
assert_raise(Curl::Err::TimeoutError) do
|
20
|
+
exception = assert_raise(Curl::Err::TimeoutError) do
|
21
21
|
curl.http_get
|
22
22
|
end
|
23
|
+
assert_match(
|
24
|
+
/^Timeout was reached: Operation timed out after/,
|
25
|
+
exception.message
|
26
|
+
)
|
23
27
|
end
|
24
28
|
|
25
29
|
def test_overall_timeout_ms_on_dead_transfer
|
@@ -44,16 +48,20 @@ class TestCurbTimeouts < Test::Unit::TestCase
|
|
44
48
|
curl = Curl::Easy.new(serve_url(100, 2, 3))
|
45
49
|
curl.timeout = 1
|
46
50
|
# transfer is aborted despite data being exchanged
|
47
|
-
assert_raise(Curl::Err::TimeoutError) do
|
51
|
+
exception = assert_raise(Curl::Err::TimeoutError) do
|
48
52
|
curl.http_get
|
49
53
|
end
|
54
|
+
assert_match(
|
55
|
+
/^Timeout was reached: Operation timed out after/,
|
56
|
+
exception.message
|
57
|
+
)
|
50
58
|
end
|
51
59
|
|
52
60
|
def test_low_speed_time_on_slow_transfer
|
53
61
|
curl = Curl::Easy.new(serve_url(100, 1, 3))
|
54
62
|
curl.low_speed_time = 2
|
55
63
|
# use default low_speed_limit of 1
|
56
|
-
|
64
|
+
assert_equal true, curl.http_get
|
57
65
|
end
|
58
66
|
|
59
67
|
def test_low_speed_time_on_very_slow_transfer
|
@@ -63,18 +71,26 @@ class TestCurbTimeouts < Test::Unit::TestCase
|
|
63
71
|
# XXX for some reason this test fails if low speed limit is not specified
|
64
72
|
curl.low_speed_limit = 1
|
65
73
|
# use default low_speed_limit of 1
|
66
|
-
assert_raise(Curl::Err::TimeoutError) do
|
74
|
+
exception = assert_raise(Curl::Err::TimeoutError) do
|
67
75
|
curl.http_get
|
68
76
|
end
|
77
|
+
assert_match(
|
78
|
+
/^Timeout was reached: Operation too slow/,
|
79
|
+
exception.message
|
80
|
+
)
|
69
81
|
end
|
70
82
|
|
71
83
|
def test_low_speed_limit_on_slow_transfer
|
72
84
|
curl = Curl::Easy.new(serve_url(10, 1, 3))
|
73
85
|
curl.low_speed_time = 2
|
74
86
|
curl.low_speed_limit = 1000
|
75
|
-
assert_raise(Curl::Err::TimeoutError) do
|
87
|
+
exception = assert_raise(Curl::Err::TimeoutError) do
|
76
88
|
curl.http_get
|
77
89
|
end
|
90
|
+
assert_match(
|
91
|
+
/^Timeout was reached: Operation too slow/,
|
92
|
+
exception.message
|
93
|
+
)
|
78
94
|
end
|
79
95
|
|
80
96
|
def test_clearing_low_speed_time
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Bamford
|
8
8
|
- Todd A. Fisher
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
|
15
15
|
for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- README.markdown
|
27
27
|
- Rakefile
|
28
28
|
- doc.rb
|
29
|
+
- ext/banned.h
|
29
30
|
- ext/curb.c
|
30
31
|
- ext/curb.h
|
31
32
|
- ext/curb_easy.c
|
@@ -49,11 +50,14 @@ files:
|
|
49
50
|
- tests/bug_crash_on_progress.rb
|
50
51
|
- tests/bug_curb_easy_blocks_ruby_threads.rb
|
51
52
|
- tests/bug_curb_easy_post_with_string_no_content_length_header.rb
|
53
|
+
- tests/bug_follow_redirect_288.rb
|
52
54
|
- tests/bug_instance_post_differs_from_class_post.rb
|
53
55
|
- tests/bug_issue102.rb
|
56
|
+
- tests/bug_issue277.rb
|
54
57
|
- tests/bug_multi_segfault.rb
|
55
58
|
- tests/bug_postfields_crash.rb
|
56
59
|
- tests/bug_postfields_crash2.rb
|
60
|
+
- tests/bug_raise_on_callback.rb
|
57
61
|
- tests/bug_require_last_or_segfault.rb
|
58
62
|
- tests/bugtests.rb
|
59
63
|
- tests/helper.rb
|
@@ -65,16 +69,18 @@ files:
|
|
65
69
|
- tests/tc_curl_easy.rb
|
66
70
|
- tests/tc_curl_easy_resolve.rb
|
67
71
|
- tests/tc_curl_easy_setopt.rb
|
72
|
+
- tests/tc_curl_maxfilesize.rb
|
68
73
|
- tests/tc_curl_multi.rb
|
69
74
|
- tests/tc_curl_postfield.rb
|
75
|
+
- tests/tc_curl_protocols.rb
|
70
76
|
- tests/timeout.rb
|
71
77
|
- tests/timeout_server.rb
|
72
78
|
- tests/unittests.rb
|
73
|
-
homepage:
|
79
|
+
homepage: https://github.com/taf2/curb
|
74
80
|
licenses:
|
75
|
-
-
|
81
|
+
- MIT
|
76
82
|
metadata: {}
|
77
|
-
post_install_message:
|
83
|
+
post_install_message:
|
78
84
|
rdoc_options:
|
79
85
|
- "--main"
|
80
86
|
- README.markdown
|
@@ -92,35 +98,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
98
|
- !ruby/object:Gem::Version
|
93
99
|
version: '0'
|
94
100
|
requirements: []
|
95
|
-
|
96
|
-
|
97
|
-
signing_key:
|
101
|
+
rubygems_version: 3.2.33
|
102
|
+
signing_key:
|
98
103
|
specification_version: 4
|
99
104
|
summary: Ruby libcurl bindings
|
100
105
|
test_files:
|
101
|
-
- tests/tc_curl_multi.rb
|
102
106
|
- tests/alltests.rb
|
103
|
-
- tests/tc_curl_easy_setopt.rb
|
104
|
-
- tests/tc_curl.rb
|
105
|
-
- tests/bug_postfields_crash.rb
|
106
|
-
- tests/bug_crash_on_progress.rb
|
107
|
-
- tests/helper.rb
|
108
|
-
- tests/bug_postfields_crash2.rb
|
109
|
-
- tests/bug_require_last_or_segfault.rb
|
110
|
-
- tests/timeout.rb
|
111
107
|
- tests/bug_crash_on_debug.rb
|
112
|
-
- tests/
|
113
|
-
- tests/bug_issue102.rb
|
108
|
+
- tests/bug_crash_on_progress.rb
|
114
109
|
- tests/bug_curb_easy_blocks_ruby_threads.rb
|
115
|
-
- tests/
|
110
|
+
- tests/bug_curb_easy_post_with_string_no_content_length_header.rb
|
111
|
+
- tests/bug_follow_redirect_288.rb
|
116
112
|
- tests/bug_instance_post_differs_from_class_post.rb
|
113
|
+
- tests/bug_issue102.rb
|
114
|
+
- tests/bug_issue277.rb
|
115
|
+
- tests/bug_multi_segfault.rb
|
116
|
+
- tests/bug_postfields_crash.rb
|
117
|
+
- tests/bug_postfields_crash2.rb
|
118
|
+
- tests/bug_raise_on_callback.rb
|
119
|
+
- tests/bug_require_last_or_segfault.rb
|
120
|
+
- tests/bugtests.rb
|
121
|
+
- tests/helper.rb
|
122
|
+
- tests/mem_check.rb
|
117
123
|
- tests/require_last_or_segfault_script.rb
|
118
|
-
- tests/
|
124
|
+
- tests/signals.rb
|
125
|
+
- tests/tc_curl.rb
|
119
126
|
- tests/tc_curl_download.rb
|
120
127
|
- tests/tc_curl_easy.rb
|
121
|
-
- tests/mem_check.rb
|
122
|
-
- tests/tc_curl_postfield.rb
|
123
|
-
- tests/bugtests.rb
|
124
128
|
- tests/tc_curl_easy_resolve.rb
|
125
|
-
- tests/
|
126
|
-
- tests/
|
129
|
+
- tests/tc_curl_easy_setopt.rb
|
130
|
+
- tests/tc_curl_maxfilesize.rb
|
131
|
+
- tests/tc_curl_multi.rb
|
132
|
+
- tests/tc_curl_postfield.rb
|
133
|
+
- tests/tc_curl_protocols.rb
|
134
|
+
- tests/timeout.rb
|
135
|
+
- tests/timeout_server.rb
|
136
|
+
- tests/unittests.rb
|