curb 0.8.3 → 0.8.4
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 +1 -1
- data/lib/curb.rb +0 -3
- data/lib/curl.rb +6 -3
- data/lib/curl/easy.rb +5 -5
- data/tests/bug_require_last_or_segfault.rb +1 -1
- data/tests/tc_curl_easy.rb +15 -0
- metadata +8 -4
- data/tests/foo.rb +0 -13
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.4"
|
24
|
+
#define CURB_VER_NUM 804
|
25
25
|
#define CURB_VER_MAJ 0
|
26
26
|
#define CURB_VER_MIN 8
|
27
|
-
#define CURB_VER_MIC
|
27
|
+
#define CURB_VER_MIC 4
|
28
28
|
#define CURB_VER_PATCH 0
|
29
29
|
|
30
30
|
|
data/ext/curb_easy.c
CHANGED
@@ -703,8 +703,8 @@ static VALUE ruby_curl_easy_post_body_set(VALUE self, VALUE post_body) {
|
|
703
703
|
curl = rbce->curl;
|
704
704
|
|
705
705
|
if ( post_body == Qnil ) {
|
706
|
-
//rbce->postdata_buffer = Qnil;
|
707
706
|
rb_easy_del("postdata_buffer");
|
707
|
+
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
|
708
708
|
|
709
709
|
} else {
|
710
710
|
if (rb_type(post_body) == T_STRING) {
|
data/lib/curb.rb
CHANGED
data/lib/curl.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
require '
|
1
|
+
require 'curb_core'
|
2
|
+
require 'curl/easy'
|
3
|
+
require 'curl/multi'
|
2
4
|
require 'uri'
|
3
5
|
|
4
6
|
# expose shortcut methods
|
5
7
|
module Curl
|
6
8
|
|
7
9
|
def self.http(verb, url, post_body=nil, put_data=nil, &block)
|
8
|
-
handle = Curl::Easy.new
|
10
|
+
handle = Thread.current[:curb_curl] ||= Curl::Easy.new
|
11
|
+
handle.url = url
|
9
12
|
handle.post_body = post_body if post_body
|
10
13
|
handle.put_data = put_data if put_data
|
11
14
|
yield handle if block_given?
|
@@ -34,7 +37,7 @@ module Curl
|
|
34
37
|
end
|
35
38
|
|
36
39
|
def self.head(url, params={}, &block)
|
37
|
-
http :
|
40
|
+
http :HEAD, urlalize(url, params), nil, nil, &block
|
38
41
|
end
|
39
42
|
|
40
43
|
def self.options(url, params={}, &block)
|
data/lib/curl/easy.rb
CHANGED
@@ -310,7 +310,7 @@ module Curl
|
|
310
310
|
# the +http_get+ call.
|
311
311
|
#
|
312
312
|
def perform(*args)
|
313
|
-
c = Curl::Easy.new
|
313
|
+
c = Curl::Easy.new(*args)
|
314
314
|
yield c if block_given?
|
315
315
|
c.perform
|
316
316
|
c
|
@@ -327,7 +327,7 @@ module Curl
|
|
327
327
|
# the +http_get+ call.
|
328
328
|
#
|
329
329
|
def http_get(*args)
|
330
|
-
c = Curl::Easy.new
|
330
|
+
c = Curl::Easy.new(*args)
|
331
331
|
yield c if block_given?
|
332
332
|
c.http_get
|
333
333
|
c
|
@@ -344,7 +344,7 @@ module Curl
|
|
344
344
|
# the +http_head+ call.
|
345
345
|
#
|
346
346
|
def http_head(*args)
|
347
|
-
c = Curl::Easy.new
|
347
|
+
c = Curl::Easy.new(*args)
|
348
348
|
yield c if block_given?
|
349
349
|
c.http_head
|
350
350
|
c
|
@@ -383,7 +383,7 @@ module Curl
|
|
383
383
|
url = args.shift
|
384
384
|
c = Curl::Easy.new url
|
385
385
|
yield c if block_given?
|
386
|
-
c.http_post
|
386
|
+
c.http_post(*args)
|
387
387
|
c
|
388
388
|
end
|
389
389
|
|
@@ -398,7 +398,7 @@ module Curl
|
|
398
398
|
# the +http_delete+ call.
|
399
399
|
#
|
400
400
|
def http_delete(*args)
|
401
|
-
c = Curl::Easy.new
|
401
|
+
c = Curl::Easy.new(*args)
|
402
402
|
yield c if block_given?
|
403
403
|
c.http_delete
|
404
404
|
c
|
data/tests/tc_curl_easy.rb
CHANGED
@@ -4,6 +4,21 @@ class FooNoToS
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class TestCurbCurlEasy < Test::Unit::TestCase
|
7
|
+
def test_threads
|
8
|
+
t = []
|
9
|
+
5.times do
|
10
|
+
t << Thread.new do
|
11
|
+
5.times do
|
12
|
+
c = Curl.get($TEST_URL)
|
13
|
+
assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
|
14
|
+
assert_equal "", c.header_str
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
t.each {|t| t.join }
|
20
|
+
end
|
21
|
+
|
7
22
|
def test_class_perform_01
|
8
23
|
assert_instance_of Curl::Easy, c = Curl::Easy.perform($TEST_URL)
|
9
24
|
assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
|
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.4
|
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:
|
13
|
+
date: 2013-05-20 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
|
@@ -57,7 +57,6 @@ files:
|
|
57
57
|
- tests/bug_postfields_crash2.rb
|
58
58
|
- tests/bug_require_last_or_segfault.rb
|
59
59
|
- tests/bugtests.rb
|
60
|
-
- tests/foo.rb
|
61
60
|
- tests/helper.rb
|
62
61
|
- tests/mem_check.rb
|
63
62
|
- tests/require_last_or_segfault_script.rb
|
@@ -86,12 +85,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
85
|
- - ! '>='
|
87
86
|
- !ruby/object:Gem::Version
|
88
87
|
version: '0'
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
hash: -243569426931689339
|
89
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
92
|
none: false
|
91
93
|
requirements:
|
92
94
|
- - ! '>='
|
93
95
|
- !ruby/object:Gem::Version
|
94
96
|
version: '0'
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
hash: -243569426931689339
|
95
100
|
requirements: []
|
96
101
|
rubyforge_project: curb
|
97
102
|
rubygems_version: 1.8.24
|
@@ -111,7 +116,6 @@ test_files:
|
|
111
116
|
- tests/bug_postfields_crash2.rb
|
112
117
|
- tests/bug_require_last_or_segfault.rb
|
113
118
|
- tests/bugtests.rb
|
114
|
-
- tests/foo.rb
|
115
119
|
- tests/helper.rb
|
116
120
|
- tests/mem_check.rb
|
117
121
|
- tests/require_last_or_segfault_script.rb
|
data/tests/foo.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'curb'
|
2
|
-
|
3
|
-
SSL_CERT = '/path/to/my/cert'
|
4
|
-
SSL_KEY = '/path/to/my/key'
|
5
|
-
|
6
|
-
curl = Curl::Easy.new('98.129.21.125')
|
7
|
-
curl.verbose = true
|
8
|
-
curl.cert = SSL_CERT
|
9
|
-
curl.cert_key = SSL_KEY
|
10
|
-
curl.follow_location = true
|
11
|
-
curl.ssl_verify_host = false
|
12
|
-
curl.ssl_verify_peer = false
|
13
|
-
curl.perform
|