curb 0.7.17 → 0.7.18
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/curb.h +3 -3
- data/ext/curb_easy.c +2 -2
- data/ext/curb_errors.c +2 -0
- data/ext/extconf.rb +2 -0
- data/tests/tc_curl_download.rb +4 -4
- data/tests/tc_curl_easy.rb +14 -3
- metadata +26 -42
data/ext/curb.h
CHANGED
@@ -20,12 +20,12 @@
|
|
20
20
|
#include "curb_macros.h"
|
21
21
|
|
22
22
|
// These should be managed from the Rake 'release' task.
|
23
|
-
#define CURB_VERSION "0.7.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.7.18"
|
24
|
+
#define CURB_VER_NUM 718
|
25
25
|
#define CURB_VER_MAJ 0
|
26
26
|
#define CURB_VER_MIN 7
|
27
27
|
#define CURB_VER_MIC 1
|
28
|
-
#define CURB_VER_PATCH
|
28
|
+
#define CURB_VER_PATCH 8
|
29
29
|
|
30
30
|
|
31
31
|
// Maybe not yet defined in Ruby
|
data/ext/curb_easy.c
CHANGED
@@ -54,7 +54,7 @@ static size_t read_data_handler(void *ptr,
|
|
54
54
|
/* copy read_bytes from stream into ptr */
|
55
55
|
VALUE str = rb_funcall(stream, rb_intern("read"), 1, rb_int_new(read_bytes) );
|
56
56
|
if( str != Qnil ) {
|
57
|
-
memcpy(ptr,
|
57
|
+
memcpy(ptr, RSTRING_PTR(str), RSTRING_LEN(str));
|
58
58
|
return RSTRING_LEN(str);
|
59
59
|
}
|
60
60
|
else {
|
@@ -71,7 +71,7 @@ static size_t read_data_handler(void *ptr,
|
|
71
71
|
str = rb_funcall(stream, rb_intern("to_s"), 0);
|
72
72
|
len = RSTRING_LEN(str);
|
73
73
|
remaining = len - rbcu->offset;
|
74
|
-
str_ptr =
|
74
|
+
str_ptr = RSTRING_PTR(str);
|
75
75
|
|
76
76
|
if( remaining < read_bytes ) {
|
77
77
|
if( remaining > 0 ) {
|
data/ext/curb_errors.c
CHANGED
@@ -286,9 +286,11 @@ VALUE rb_curl_easy_error(CURLcode code) {
|
|
286
286
|
case CURLE_TELNET_OPTION_SYNTAX: /* 49 - Malformed telnet option */
|
287
287
|
exclz = eCurlErrTelnetBadOptionSyntax;
|
288
288
|
break;
|
289
|
+
#ifdef HAVE_CURLE_OBSOLETE
|
289
290
|
case CURLE_OBSOLETE: /* 50 - NOT USED */
|
290
291
|
exclz = eCurlErrObsolete;
|
291
292
|
break;
|
293
|
+
#endif
|
292
294
|
case CURLE_SSL_PEER_CERTIFICATE: /* 51 - peer's certificate wasn't ok */
|
293
295
|
exclz = eCurlErrSSLPeerCertificate;
|
294
296
|
break;
|
data/ext/extconf.rb
CHANGED
@@ -346,6 +346,8 @@ have_constant "curlopt_telnetoptions"
|
|
346
346
|
# was obsoleted in August 2007 for 7.17.0, reused in April 2011 for 7.21.5
|
347
347
|
have_constant "curle_not_built_in"
|
348
348
|
|
349
|
+
have_constant "curle_obsolete" # removed in 7.24 ?
|
350
|
+
|
349
351
|
if try_compile('int main() { return 0; }','-Wall')
|
350
352
|
$CFLAGS << ' -Wall'
|
351
353
|
end
|
data/tests/tc_curl_download.rb
CHANGED
@@ -8,7 +8,7 @@ class TestCurbCurlDownload < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_download_url_to_file_via_string
|
11
|
-
dl_url = "http://
|
11
|
+
dl_url = "http://localhost:9129/ext/curb_easy.c"
|
12
12
|
dl_path = File.join(Dir::tmpdir, "dl_url_test.file")
|
13
13
|
|
14
14
|
curb = Curl::Easy.download(dl_url, dl_path)
|
@@ -19,7 +19,7 @@ class TestCurbCurlDownload < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_download_url_to_file_via_file_io
|
22
|
-
dl_url = "http://
|
22
|
+
dl_url = "http://localhost:9129/ext/curb_easy.c"
|
23
23
|
dl_path = File.join(Dir::tmpdir, "dl_url_test.file")
|
24
24
|
io = File.open(dl_path, 'wb')
|
25
25
|
|
@@ -32,7 +32,7 @@ class TestCurbCurlDownload < Test::Unit::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_download_url_to_file_via_io
|
35
|
-
dl_url = "http://
|
35
|
+
dl_url = "http://localhost:9129/ext/curb_easy.c"
|
36
36
|
dl_path = File.join(Dir::tmpdir, "dl_url_test.file")
|
37
37
|
reader, writer = IO.pipe
|
38
38
|
|
@@ -62,7 +62,7 @@ class TestCurbCurlDownload < Test::Unit::TestCase
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def test_download_bad_url_gives_404
|
65
|
-
dl_url = "http://
|
65
|
+
dl_url = "http://localhost:9129/this_file_does_not_exist.html"
|
66
66
|
dl_path = File.join(Dir::tmpdir, "dl_url_test.file")
|
67
67
|
|
68
68
|
curb = Curl::Easy.download(dl_url, dl_path)
|
data/tests/tc_curl_easy.rb
CHANGED
@@ -510,11 +510,11 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
510
510
|
|
511
511
|
def test_resolve_mode
|
512
512
|
c = Curl::Easy.new
|
513
|
-
|
513
|
+
assert_equal :auto, c.resolve_mode
|
514
514
|
c.resolve_mode = :ipv4
|
515
|
-
|
515
|
+
assert_equal :ipv4, c.resolve_mode
|
516
516
|
c.resolve_mode = :ipv6
|
517
|
-
|
517
|
+
assert_equal :ipv6, c.resolve_mode
|
518
518
|
|
519
519
|
assert_raises(ArgumentError) { c.resolve_mode = :bad }
|
520
520
|
end
|
@@ -683,6 +683,17 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
683
683
|
assert_match /message$/, curl.body_str
|
684
684
|
end
|
685
685
|
|
686
|
+
# https://github.com/taf2/curb/issues/101
|
687
|
+
def test_put_data_null_bytes
|
688
|
+
curl = Curl::Easy.new(TestServlet.url)
|
689
|
+
curl.put_data = "a\0b"
|
690
|
+
|
691
|
+
curl.perform
|
692
|
+
|
693
|
+
assert_match /^PUT/, curl.body_str
|
694
|
+
assert_match "a\0b", curl.body_str
|
695
|
+
end
|
696
|
+
|
686
697
|
def test_put_nil_data_no_crash
|
687
698
|
curl = Curl::Easy.new(TestServlet.url)
|
688
699
|
curl.put_data = nil
|
metadata
CHANGED
@@ -1,35 +1,28 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: curb
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 17
|
10
|
-
version: 0.7.17
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.18
|
5
|
+
prerelease:
|
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: 2012-01-09 00:00:00 -05:00
|
20
|
-
default_executable:
|
13
|
+
date: 2012-01-16 00:00:00.000000000 Z
|
21
14
|
dependencies: []
|
22
|
-
|
23
|
-
|
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
|
@@ -73,43 +66,34 @@ files:
|
|
73
66
|
- tests/timeout.rb
|
74
67
|
- tests/timeout_server.rb
|
75
68
|
- tests/unittests.rb
|
76
|
-
has_rdoc: true
|
77
69
|
homepage: http://curb.rubyforge.org/
|
78
70
|
licenses: []
|
79
|
-
|
80
71
|
post_install_message:
|
81
|
-
rdoc_options:
|
72
|
+
rdoc_options:
|
82
73
|
- --main
|
83
74
|
- README
|
84
|
-
require_paths:
|
75
|
+
require_paths:
|
85
76
|
- lib
|
86
77
|
- ext
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
79
|
none: false
|
89
|
-
requirements:
|
90
|
-
- -
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
|
94
|
-
- 0
|
95
|
-
version: "0"
|
96
|
-
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
|
97
85
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
version: "0"
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
105
90
|
requirements: []
|
106
|
-
|
107
91
|
rubyforge_project: curb
|
108
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 1.8.10
|
109
93
|
signing_key:
|
110
94
|
specification_version: 3
|
111
95
|
summary: Ruby libcurl bindings
|
112
|
-
test_files:
|
96
|
+
test_files:
|
113
97
|
- tests/alltests.rb
|
114
98
|
- tests/bug_crash_on_progress.rb
|
115
99
|
- tests/bug_curb_easy_blocks_ruby_threads.rb
|