curb 0.8.2 → 0.8.3
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_multi.c +4 -2
- data/lib/curl.rb +4 -2
- data/tests/bug_crash_on_debug.rb +1 -1
- data/tests/bug_crash_on_progress.rb +1 -1
- data/tests/bug_curb_easy_blocks_ruby_threads.rb +2 -2
- data/tests/signals.rb +33 -0
- data/tests/tc_curl_download.rb +4 -4
- metadata +4 -2
data/ext/curb.h
CHANGED
@@ -20,11 +20,11 @@
|
|
20
20
|
#include "curb_macros.h"
|
21
21
|
|
22
22
|
// These should be managed from the Rake 'release' task.
|
23
|
-
#define CURB_VERSION "0.8.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.8.3"
|
24
|
+
#define CURB_VER_NUM 803
|
25
25
|
#define CURB_VER_MAJ 0
|
26
26
|
#define CURB_VER_MIN 8
|
27
|
-
#define CURB_VER_MIC
|
27
|
+
#define CURB_VER_MIC 3
|
28
28
|
#define CURB_VER_PATCH 0
|
29
29
|
|
30
30
|
|
data/ext/curb_multi.c
CHANGED
@@ -589,8 +589,10 @@ VALUE ruby_curl_multi_perform(int argc, VALUE *argv, VALUE self) {
|
|
589
589
|
|
590
590
|
switch(rc) {
|
591
591
|
case -1:
|
592
|
-
|
593
|
-
|
592
|
+
if(errno != EINTR) {
|
593
|
+
rb_raise(rb_eRuntimeError, "select(): %s", strerror(errno));
|
594
|
+
break;
|
595
|
+
}
|
594
596
|
case 0: /* timeout */
|
595
597
|
default: /* action */
|
596
598
|
rb_curl_multi_run( self, rbcm->handle, &(rbcm->running) );
|
data/lib/curl.rb
CHANGED
@@ -45,13 +45,15 @@ module Curl
|
|
45
45
|
query_str = params.map {|k,v| "#{URI.escape(k.to_s)}=#{URI.escape(v.to_s)}" }.join('&')
|
46
46
|
if url.match(/\?/)
|
47
47
|
"#{url}&#{query_str}"
|
48
|
-
|
48
|
+
elsif query_str.size > 0
|
49
49
|
"#{url}?#{query_str}"
|
50
|
+
else
|
51
|
+
url
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
55
|
def self.postalize(params={})
|
54
|
-
params.
|
56
|
+
params.respond_to?(:map) ? URI.encode_www_form(params) : (params.respond_to?(:to_s) ? params.to_s : params)
|
55
57
|
end
|
56
58
|
|
57
59
|
end
|
data/tests/bug_crash_on_debug.rb
CHANGED
@@ -19,7 +19,7 @@ class BugCrashOnDebug < Test::Unit::TestCase
|
|
19
19
|
srv.start
|
20
20
|
end
|
21
21
|
puts 'b'
|
22
|
-
c = Curl::Easy.new('http://
|
22
|
+
c = Curl::Easy.new('http://127.0.0.1:9999/test')
|
23
23
|
c.on_debug do|x|
|
24
24
|
puts x.inspect
|
25
25
|
raise "error" # this will get swallowed
|
@@ -21,7 +21,7 @@ class BugTestInstancePostDiffersFromClassPost < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
5.times do |i|
|
23
23
|
t = Thread.new do
|
24
|
-
c = Curl::Easy.perform('http://
|
24
|
+
c = Curl::Easy.perform('http://127.0.0.1:9999/test')
|
25
25
|
c.header_str
|
26
26
|
end
|
27
27
|
threads << t
|
@@ -37,7 +37,7 @@ class BugTestInstancePostDiffersFromClassPost < Test::Unit::TestCase
|
|
37
37
|
timer = Time.now
|
38
38
|
single_responses = []
|
39
39
|
5.times do |i|
|
40
|
-
c = Curl::Easy.perform('http://
|
40
|
+
c = Curl::Easy.perform('http://127.0.0.1:9999/test')
|
41
41
|
single_responses << c.header_str
|
42
42
|
end
|
43
43
|
|
data/tests/signals.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
|
3
|
+
# This test suite requires the timeout server to be running
|
4
|
+
# See tests/timeout.rb for more info about the timeout server
|
5
|
+
class TestCurbSignals < Test::Unit::TestCase
|
6
|
+
|
7
|
+
# Testcase for https://github.com/taf2/curb/issues/117
|
8
|
+
def test_continue_after_signal
|
9
|
+
trap("SIGUSR1") { }
|
10
|
+
|
11
|
+
curl = Curl::Easy.new(wait_url(2))
|
12
|
+
pid = $$
|
13
|
+
Thread.new do
|
14
|
+
sleep 1
|
15
|
+
Process.kill("SIGUSR1", pid)
|
16
|
+
end
|
17
|
+
assert_equal true, curl.http_get
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def wait_url(time)
|
23
|
+
"#{server_base}/wait/#{time}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def serve_url(chunk_size, time, count)
|
27
|
+
"#{server_base}/serve/#{chunk_size}/every/#{time}/for/#{count}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def server_base
|
31
|
+
'http://127.0.0.1:9128'
|
32
|
+
end
|
33
|
+
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://127.0.0.1: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://127.0.0.1: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://127.0.0.1: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://127.0.0.1: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)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-11-
|
13
|
+
date: 2012-11-09 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
|
16
16
|
for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- tests/helper.rb
|
62
62
|
- tests/mem_check.rb
|
63
63
|
- tests/require_last_or_segfault_script.rb
|
64
|
+
- tests/signals.rb
|
64
65
|
- tests/tc_curl.rb
|
65
66
|
- tests/tc_curl_download.rb
|
66
67
|
- tests/tc_curl_easy.rb
|
@@ -114,6 +115,7 @@ test_files:
|
|
114
115
|
- tests/helper.rb
|
115
116
|
- tests/mem_check.rb
|
116
117
|
- tests/require_last_or_segfault_script.rb
|
118
|
+
- tests/signals.rb
|
117
119
|
- tests/tc_curl.rb
|
118
120
|
- tests/tc_curl_download.rb
|
119
121
|
- tests/tc_curl_easy.rb
|