fotonauts-curb 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +51 -0
- data/README +158 -0
- data/Rakefile +316 -0
- data/doc.rb +42 -0
- data/ext/curb.c +373 -0
- data/ext/curb.h +52 -0
- data/ext/curb_easy.c +3382 -0
- data/ext/curb_easy.h +84 -0
- data/ext/curb_errors.c +637 -0
- data/ext/curb_errors.h +129 -0
- data/ext/curb_macros.h +155 -0
- data/ext/curb_multi.c +512 -0
- data/ext/curb_multi.h +26 -0
- data/ext/curb_postfield.c +511 -0
- data/ext/curb_postfield.h +40 -0
- data/ext/curb_upload.c +80 -0
- data/ext/curb_upload.h +30 -0
- data/ext/extconf.rb +177 -0
- data/lib/curb.rb +255 -0
- data/lib/curl.rb +2 -0
- data/tests/alltests.rb +3 -0
- data/tests/bug_curb_easy_blocks_ruby_threads.rb +52 -0
- data/tests/bug_curb_easy_post_with_string_no_content_length_header.rb +83 -0
- data/tests/bug_instance_post_differs_from_class_post.rb +53 -0
- data/tests/bug_multi_segfault.rb +14 -0
- data/tests/bug_postfields_crash.rb +26 -0
- data/tests/bug_postfields_crash2.rb +57 -0
- data/tests/bug_require_last_or_segfault.rb +40 -0
- data/tests/bugtests.rb +9 -0
- data/tests/helper.rb +178 -0
- data/tests/mem_check.rb +65 -0
- data/tests/require_last_or_segfault_script.rb +36 -0
- data/tests/tc_curl_download.rb +32 -0
- data/tests/tc_curl_easy.rb +778 -0
- data/tests/tc_curl_multi.rb +461 -0
- data/tests/tc_curl_postfield.rb +141 -0
- data/tests/unittests.rb +2 -0
- metadata +101 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
|
3
|
+
class TestCurbCurlPostfield < Test::Unit::TestCase
|
4
|
+
def test_private_new
|
5
|
+
assert_raise(NoMethodError) { Curl::PostField.new }
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_new_content_01
|
9
|
+
pf = Curl::PostField.content('foo', 'bar')
|
10
|
+
|
11
|
+
assert_equal 'foo', pf.name
|
12
|
+
assert_equal 'bar', pf.content
|
13
|
+
assert_nil pf.content_type
|
14
|
+
assert_nil pf.local_file
|
15
|
+
assert_nil pf.remote_file
|
16
|
+
assert_nil pf.set_content_proc
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_new_content_02
|
20
|
+
pf = Curl::PostField.content('foo', 'bar', 'text/html')
|
21
|
+
|
22
|
+
assert_equal 'foo', pf.name
|
23
|
+
assert_equal 'bar', pf.content
|
24
|
+
assert_equal 'text/html', pf.content_type
|
25
|
+
assert_nil pf.local_file
|
26
|
+
assert_nil pf.remote_file
|
27
|
+
assert_nil pf.set_content_proc
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_new_content_03
|
31
|
+
l = lambda { |field| "never gets run" }
|
32
|
+
pf = Curl::PostField.content('foo', &l)
|
33
|
+
|
34
|
+
assert_equal 'foo', pf.name
|
35
|
+
assert_nil pf.content
|
36
|
+
assert_nil pf.content_type
|
37
|
+
assert_nil pf.local_file
|
38
|
+
assert_nil pf.remote_file
|
39
|
+
|
40
|
+
# N.B. This doesn't just get the proc, but also removes it.
|
41
|
+
assert_equal l, pf.set_content_proc
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_new_content_04
|
45
|
+
l = lambda { |field| "never gets run" }
|
46
|
+
pf = Curl::PostField.content('foo', 'text/html', &l)
|
47
|
+
|
48
|
+
assert_equal 'foo', pf.name
|
49
|
+
assert_nil pf.content
|
50
|
+
assert_equal 'text/html', pf.content_type
|
51
|
+
assert_nil pf.local_file
|
52
|
+
assert_nil pf.remote_file
|
53
|
+
|
54
|
+
# N.B. This doesn't just get the proc, but also removes it.
|
55
|
+
assert_equal l, pf.set_content_proc
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
def test_new_file_01
|
60
|
+
pf = Curl::PostField.file('foo', 'localname')
|
61
|
+
|
62
|
+
assert_equal 'foo', pf.name
|
63
|
+
assert_equal 'localname', pf.local_file
|
64
|
+
assert_equal 'localname', pf.remote_file
|
65
|
+
assert_nil pf.content_type
|
66
|
+
assert_nil pf.content
|
67
|
+
assert_nil pf.set_content_proc
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_new_file_02
|
71
|
+
pf = Curl::PostField.file('foo', 'localname', 'remotename')
|
72
|
+
|
73
|
+
assert_equal 'foo', pf.name
|
74
|
+
assert_equal 'localname', pf.local_file
|
75
|
+
assert_equal 'remotename', pf.remote_file
|
76
|
+
assert_nil pf.content_type
|
77
|
+
assert_nil pf.content
|
78
|
+
assert_nil pf.set_content_proc
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_new_file_03
|
82
|
+
l = lambda { |field| "never gets run" }
|
83
|
+
pf = Curl::PostField.file('foo', 'remotename', &l)
|
84
|
+
|
85
|
+
assert_equal 'foo', pf.name
|
86
|
+
assert_equal 'remotename', pf.remote_file
|
87
|
+
assert_nil pf.local_file
|
88
|
+
assert_nil pf.content_type
|
89
|
+
assert_nil pf.content
|
90
|
+
|
91
|
+
# N.B. This doesn't just get the proc, but also removes it.
|
92
|
+
assert_equal l, pf.set_content_proc
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_new_file_04
|
96
|
+
assert_raise(ArgumentError) do
|
97
|
+
# no local name, no block
|
98
|
+
Curl::PostField.file('foo')
|
99
|
+
end
|
100
|
+
|
101
|
+
assert_raise(ArgumentError) do
|
102
|
+
# no remote name with block
|
103
|
+
Curl::PostField.file('foo') { |field| "never runs" }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_new_file_05
|
108
|
+
# local gets ignored when supplying a block, but remote
|
109
|
+
# is still set up properly.
|
110
|
+
l = lambda { |field| "never runs" }
|
111
|
+
pf = Curl::PostField.file('foo', 'local', 'remote', &l)
|
112
|
+
|
113
|
+
assert_equal 'foo', pf.name
|
114
|
+
assert_equal 'remote', pf.remote_file
|
115
|
+
assert_nil pf.local_file
|
116
|
+
assert_nil pf.content_type
|
117
|
+
assert_nil pf.content
|
118
|
+
|
119
|
+
assert_equal l, pf.set_content_proc
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_to_s_01
|
123
|
+
pf = Curl::PostField.content('foo', 'bar')
|
124
|
+
assert_equal "foo=bar", pf.to_s
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_to_s_02
|
128
|
+
pf = Curl::PostField.content('foo', 'bar ton')
|
129
|
+
assert_equal "foo=bar%20ton", pf.to_s
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_to_s_03
|
133
|
+
pf = Curl::PostField.content('foo') { |field| field.name.upcase + "BAR" }
|
134
|
+
assert_equal "foo=FOOBAR", pf.to_s
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_to_s_04
|
138
|
+
pf = Curl::PostField.file('foo.file', 'bar.file')
|
139
|
+
assert_raise(Curl::Err::InvalidPostFieldError) { pf.to_s }
|
140
|
+
end
|
141
|
+
end
|
data/tests/unittests.rb
ADDED
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fotonauts-curb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 7
|
8
|
+
- 7
|
9
|
+
version: 0.7.7
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ross Bamford
|
13
|
+
- Todd A. Fisher
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-06-21 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
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/
|
23
|
+
email: todd.fisher@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions:
|
27
|
+
- ext/extconf.rb
|
28
|
+
extra_rdoc_files:
|
29
|
+
- LICENSE
|
30
|
+
- README
|
31
|
+
files:
|
32
|
+
- LICENSE
|
33
|
+
- README
|
34
|
+
- Rakefile
|
35
|
+
- doc.rb
|
36
|
+
- ext/extconf.rb
|
37
|
+
- lib/curl.rb
|
38
|
+
- lib/curb.rb
|
39
|
+
- ext/curb.c
|
40
|
+
- ext/curb_upload.c
|
41
|
+
- ext/curb_postfield.c
|
42
|
+
- ext/curb_easy.c
|
43
|
+
- ext/curb_multi.c
|
44
|
+
- ext/curb_errors.c
|
45
|
+
- ext/curb_errors.h
|
46
|
+
- ext/curb_multi.h
|
47
|
+
- ext/curb.h
|
48
|
+
- ext/curb_easy.h
|
49
|
+
- ext/curb_postfield.h
|
50
|
+
- ext/curb_upload.h
|
51
|
+
- ext/curb_macros.h
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: http://curb.rubyforge.org/
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options:
|
58
|
+
- --main
|
59
|
+
- README
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
- ext
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project: curb
|
80
|
+
rubygems_version: 1.3.6
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Ruby libcurl bindings
|
84
|
+
test_files:
|
85
|
+
- tests/bugtests.rb
|
86
|
+
- tests/mem_check.rb
|
87
|
+
- tests/bug_require_last_or_segfault.rb
|
88
|
+
- tests/helper.rb
|
89
|
+
- tests/tc_curl_postfield.rb
|
90
|
+
- tests/bug_instance_post_differs_from_class_post.rb
|
91
|
+
- tests/bug_multi_segfault.rb
|
92
|
+
- tests/alltests.rb
|
93
|
+
- tests/bug_postfields_crash.rb
|
94
|
+
- tests/require_last_or_segfault_script.rb
|
95
|
+
- tests/bug_postfields_crash2.rb
|
96
|
+
- tests/unittests.rb
|
97
|
+
- tests/tc_curl_multi.rb
|
98
|
+
- tests/bug_curb_easy_post_with_string_no_content_length_header.rb
|
99
|
+
- tests/tc_curl_download.rb
|
100
|
+
- tests/tc_curl_easy.rb
|
101
|
+
- tests/bug_curb_easy_blocks_ruby_threads.rb
|