curb 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of curb might be problematic. Click here for more details.
- data/ext/curb.h +6 -3
- data/ext/curb_easy.c +30 -1
- data/tests/tc_curl_easy.rb +14 -0
- metadata +6 -4
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.3.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.3.3"
|
24
|
+
#define CURB_VER_NUM 330
|
25
25
|
#define CURB_VER_MAJ 0
|
26
26
|
#define CURB_VER_MIN 3
|
27
|
-
#define CURB_VER_MIC
|
27
|
+
#define CURB_VER_MIC 3
|
28
28
|
#define CURB_VER_PATCH 0
|
29
29
|
|
30
30
|
|
@@ -32,6 +32,9 @@
|
|
32
32
|
#ifndef RSTRING_LEN
|
33
33
|
#define RSTRING_LEN(x) RSTRING(x)->len
|
34
34
|
#endif
|
35
|
+
#ifndef RSTRING_PTR
|
36
|
+
#define RSTRING_PTR(x) RSTRING(x)->ptr
|
37
|
+
#endif
|
35
38
|
|
36
39
|
#ifdef HAVE_RUBY19_HASH
|
37
40
|
#define RHASH_LEN(hash) RHASH(hash)->ntbl->num_entries
|
data/ext/curb_easy.c
CHANGED
@@ -1637,7 +1637,11 @@ static VALUE ruby_curl_easy_perform_delete(VALUE self) {
|
|
1637
1637
|
* when using HTTP URLs).
|
1638
1638
|
*/
|
1639
1639
|
static VALUE ruby_curl_easy_perform(VALUE self) {
|
1640
|
-
|
1640
|
+
ruby_curl_easy *rbce;
|
1641
|
+
|
1642
|
+
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
1643
|
+
|
1644
|
+
return handle_perform(self,rbce);
|
1641
1645
|
}
|
1642
1646
|
|
1643
1647
|
/*
|
@@ -1739,6 +1743,30 @@ static VALUE ruby_curl_easy_perform_head(VALUE self) {
|
|
1739
1743
|
return handle_perform(self,rbce);
|
1740
1744
|
}
|
1741
1745
|
|
1746
|
+
|
1747
|
+
/*
|
1748
|
+
*call-seq:
|
1749
|
+
* easy = Curl::Easy.new("url") do|c|
|
1750
|
+
* c.head = true
|
1751
|
+
* end
|
1752
|
+
* easy.perform
|
1753
|
+
*/
|
1754
|
+
static VALUE ruby_curl_easy_set_head_option(VALUE self, VALUE onoff) {
|
1755
|
+
ruby_curl_easy *rbce;
|
1756
|
+
|
1757
|
+
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
1758
|
+
|
1759
|
+
if( onoff == Qtrue ) {
|
1760
|
+
curl_easy_setopt(rbce->curl, CURLOPT_NOBODY, 1);
|
1761
|
+
}
|
1762
|
+
else {
|
1763
|
+
curl_easy_setopt(rbce->curl, CURLOPT_NOBODY, 0);
|
1764
|
+
}
|
1765
|
+
|
1766
|
+
return onoff;
|
1767
|
+
}
|
1768
|
+
|
1769
|
+
|
1742
1770
|
/*
|
1743
1771
|
* call-seq:
|
1744
1772
|
* easy.http_put(data) => true
|
@@ -2616,6 +2644,7 @@ void init_curb_easy() {
|
|
2616
2644
|
rb_define_method(cCurlEasy, "http_get", ruby_curl_easy_perform_get, 0);
|
2617
2645
|
rb_define_method(cCurlEasy, "http_post", ruby_curl_easy_perform_post, -1);
|
2618
2646
|
rb_define_method(cCurlEasy, "http_head", ruby_curl_easy_perform_head, 0);
|
2647
|
+
rb_define_method(cCurlEasy, "head=", ruby_curl_easy_set_head_option, 1);
|
2619
2648
|
rb_define_method(cCurlEasy, "http_put", ruby_curl_easy_perform_put, 1);
|
2620
2649
|
|
2621
2650
|
/* Post-perform info methods */
|
data/tests/tc_curl_easy.rb
CHANGED
@@ -490,6 +490,20 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
490
490
|
assert_match '/nonexistent', redirect[1]
|
491
491
|
end
|
492
492
|
|
493
|
+
def test_head_accessor
|
494
|
+
curl = Curl::Easy.new(TestServlet.url)
|
495
|
+
curl.head = true
|
496
|
+
curl.perform
|
497
|
+
|
498
|
+
redirect = curl.header_str.match(/Location: (.*)/)
|
499
|
+
|
500
|
+
assert_equal '', curl.body_str
|
501
|
+
assert_match '/nonexistent', redirect[1]
|
502
|
+
curl.head = false
|
503
|
+
curl.perform
|
504
|
+
assert_equal 'GET', curl.body_str
|
505
|
+
end
|
506
|
+
|
493
507
|
def test_put_remote
|
494
508
|
curl = Curl::Easy.new(TestServlet.url)
|
495
509
|
assert curl.http_put("message")
|
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.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Bamford
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-04-25 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -45,6 +45,8 @@ files:
|
|
45
45
|
- ext/curb_postfield.h
|
46
46
|
has_rdoc: true
|
47
47
|
homepage: http://curb.rubyforge.org/
|
48
|
+
licenses: []
|
49
|
+
|
48
50
|
post_install_message:
|
49
51
|
rdoc_options:
|
50
52
|
- --main
|
@@ -67,9 +69,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
69
|
requirements: []
|
68
70
|
|
69
71
|
rubyforge_project: curb
|
70
|
-
rubygems_version: 1.3.
|
72
|
+
rubygems_version: 1.3.2
|
71
73
|
signing_key:
|
72
|
-
specification_version:
|
74
|
+
specification_version: 3
|
73
75
|
summary: Ruby libcurl bindings
|
74
76
|
test_files:
|
75
77
|
- tests/alltests.rb
|