curb 0.6.7 → 0.6.8
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 +3 -3
- data/ext/curb_easy.c +34 -12
- data/tests/helper.rb +4 -0
- data/tests/tc_curl_easy.rb +6 -0
- metadata +33 -26
- data/tests/bug_issue20.rb +0 -10
- data/tests/s.rb +0 -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.6.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.6.8"
|
24
|
+
#define CURB_VER_NUM 680
|
25
25
|
#define CURB_VER_MAJ 0
|
26
26
|
#define CURB_VER_MIN 6
|
27
|
-
#define CURB_VER_MIC
|
27
|
+
#define CURB_VER_MIC 8
|
28
28
|
#define CURB_VER_PATCH 0
|
29
29
|
|
30
30
|
|
data/ext/curb_easy.c
CHANGED
@@ -666,6 +666,7 @@ static VALUE ruby_curl_easy_put_data_set(VALUE self, VALUE data) {
|
|
666
666
|
ruby_curl_easy *rbce;
|
667
667
|
CURL *curl;
|
668
668
|
VALUE upload;
|
669
|
+
VALUE headers;
|
669
670
|
|
670
671
|
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
671
672
|
|
@@ -692,7 +693,7 @@ static VALUE ruby_curl_easy_put_data_set(VALUE self, VALUE data) {
|
|
692
693
|
}
|
693
694
|
}
|
694
695
|
|
695
|
-
|
696
|
+
headers = rb_easy_get("headers");
|
696
697
|
if( headers == Qnil ) {
|
697
698
|
headers = rb_hash_new();
|
698
699
|
}
|
@@ -856,12 +857,14 @@ static VALUE ruby_curl_easy_proxy_type_get(VALUE self) {
|
|
856
857
|
static VALUE ruby_curl_easy_http_auth_types_set(int argc, VALUE *argv, VALUE self) {//VALUE self, VALUE http_auth_types) {
|
857
858
|
ruby_curl_easy *rbce;
|
858
859
|
VALUE args_ary;
|
859
|
-
|
860
|
-
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
861
|
-
int i, len = RARRAY_LEN(args_ary);
|
860
|
+
int i, len;
|
862
861
|
char* node = NULL;
|
863
862
|
long mask = 0x000000;
|
864
863
|
|
864
|
+
rb_scan_args(argc, argv, "*", &args_ary);
|
865
|
+
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
866
|
+
len = RARRAY_LEN(args_ary);
|
867
|
+
|
865
868
|
if (len == 1 && (TYPE(rb_ary_entry(args_ary,0)) == T_FIXNUM || rb_ary_entry(args_ary,0) == Qnil)) {
|
866
869
|
if (rb_ary_entry(args_ary,0) == Qnil) {
|
867
870
|
rbce->http_auth_types = 0;
|
@@ -1853,14 +1856,9 @@ static VALUE ruby_curl_easy_perform_get(VALUE self) {
|
|
1853
1856
|
}
|
1854
1857
|
|
1855
1858
|
/*
|
1856
|
-
*
|
1857
|
-
* easy.http_delete
|
1858
|
-
*
|
1859
|
-
* DELETE the currently configured URL using the current options set for
|
1860
|
-
* this Curl::Easy instance. This method always returns true, or raises
|
1861
|
-
* an exception (defined under Curl::Err) on error.
|
1859
|
+
* Common implementation of easy.http(verb) and easy.http_delete
|
1862
1860
|
*/
|
1863
|
-
static VALUE
|
1861
|
+
static VALUE ruby_curl_easy_perform_verb_str(VALUE self, char *verb) {
|
1864
1862
|
ruby_curl_easy *rbce;
|
1865
1863
|
CURL *curl;
|
1866
1864
|
VALUE retval;
|
@@ -1868,7 +1866,7 @@ static VALUE ruby_curl_easy_perform_delete(VALUE self) {
|
|
1868
1866
|
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
1869
1867
|
curl = rbce->curl;
|
1870
1868
|
|
1871
|
-
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST,
|
1869
|
+
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, verb);
|
1872
1870
|
|
1873
1871
|
retval = handle_perform(self,rbce);
|
1874
1872
|
|
@@ -1877,6 +1875,29 @@ static VALUE ruby_curl_easy_perform_delete(VALUE self) {
|
|
1877
1875
|
return retval;
|
1878
1876
|
}
|
1879
1877
|
|
1878
|
+
/*
|
1879
|
+
* call-seq:
|
1880
|
+
* easy.http_delete
|
1881
|
+
*
|
1882
|
+
* DELETE the currently configured URL using the current options set for
|
1883
|
+
* this Curl::Easy instance. This method always returns true, or raises
|
1884
|
+
* an exception (defined under Curl::Err) on error.
|
1885
|
+
*/
|
1886
|
+
static VALUE ruby_curl_easy_perform_delete(VALUE self) {
|
1887
|
+
return ruby_curl_easy_perform_verb_str(self, "DELETE");
|
1888
|
+
}
|
1889
|
+
|
1890
|
+
/*
|
1891
|
+
* call-seq:
|
1892
|
+
* easy.http(verb)
|
1893
|
+
*
|
1894
|
+
* Send an HTTP request with method set to verb, using the current options set for this Curl::Easy instance.
|
1895
|
+
* This method always returns true or raises an exception (defined under Curl::Err) on error.
|
1896
|
+
*/
|
1897
|
+
static VALUE ruby_curl_easy_perform_verb(VALUE self, VALUE verb) {
|
1898
|
+
return ruby_curl_easy_perform_verb_str(self, RSTRING_PTR(verb));
|
1899
|
+
}
|
1900
|
+
|
1880
1901
|
/*
|
1881
1902
|
* call-seq:
|
1882
1903
|
* easy.perform => true
|
@@ -2941,6 +2962,7 @@ void init_curb_easy() {
|
|
2941
2962
|
rb_define_method(cCurlEasy, "on_complete", ruby_curl_easy_on_complete_set, -1);
|
2942
2963
|
|
2943
2964
|
rb_define_method(cCurlEasy, "perform", ruby_curl_easy_perform, 0);
|
2965
|
+
rb_define_method(cCurlEasy, "http", ruby_curl_easy_perform_verb, 1);
|
2944
2966
|
rb_define_method(cCurlEasy, "http_delete", ruby_curl_easy_perform_delete, 0);
|
2945
2967
|
rb_define_method(cCurlEasy, "http_get", ruby_curl_easy_perform_get, 0);
|
2946
2968
|
rb_define_method(cCurlEasy, "http_post", ruby_curl_easy_perform_post, -1);
|
data/tests/helper.rb
CHANGED
data/tests/tc_curl_easy.rb
CHANGED
@@ -554,6 +554,12 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
554
554
|
assert_equal 'DELETE', curl.body_str
|
555
555
|
end
|
556
556
|
|
557
|
+
def test_arbitrary_http_verb
|
558
|
+
curl = Curl::Easy.new(TestServlet.url)
|
559
|
+
curl.http('PURGE')
|
560
|
+
assert_equal 'PURGE', curl.body_str
|
561
|
+
end
|
562
|
+
|
557
563
|
def test_head_remote
|
558
564
|
curl = Curl::Easy.new(TestServlet.url)
|
559
565
|
curl.http_head
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 6
|
8
|
+
- 8
|
9
|
+
version: 0.6.8
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Ross Bamford
|
@@ -10,7 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2010-
|
18
|
+
date: 2010-04-14 00:00:00 -04:00
|
14
19
|
default_executable:
|
15
20
|
dependencies: []
|
16
21
|
|
@@ -32,20 +37,22 @@ files:
|
|
32
37
|
- lib/curb.rb
|
33
38
|
- lib/curl.rb
|
34
39
|
- ext/curb.c
|
35
|
-
- ext/curb_postfield.c
|
36
|
-
- ext/curb_multi.c
|
37
|
-
- ext/curb_errors.c
|
38
40
|
- ext/curb_easy.c
|
41
|
+
- ext/curb_errors.c
|
42
|
+
- ext/curb_multi.c
|
43
|
+
- ext/curb_postfield.c
|
39
44
|
- ext/curb_upload.c
|
45
|
+
- ext/curb.h
|
40
46
|
- ext/curb_easy.h
|
41
47
|
- ext/curb_errors.h
|
42
|
-
- ext/curb_upload.h
|
43
48
|
- ext/curb_macros.h
|
44
|
-
- ext/curb.h
|
45
|
-
- ext/curb_postfield.h
|
46
49
|
- ext/curb_multi.h
|
50
|
+
- ext/curb_postfield.h
|
51
|
+
- ext/curb_upload.h
|
47
52
|
has_rdoc: true
|
48
53
|
homepage: http://curb.rubyforge.org/
|
54
|
+
licenses: []
|
55
|
+
|
49
56
|
post_install_message:
|
50
57
|
rdoc_options:
|
51
58
|
- --main
|
@@ -57,38 +64,38 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
64
|
requirements:
|
58
65
|
- - ">="
|
59
66
|
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
60
69
|
version: "0"
|
61
|
-
version:
|
62
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
71
|
requirements:
|
64
72
|
- - ">="
|
65
73
|
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 0
|
66
76
|
version: "0"
|
67
|
-
version:
|
68
77
|
requirements: []
|
69
78
|
|
70
79
|
rubyforge_project: curb
|
71
|
-
rubygems_version: 1.3.
|
80
|
+
rubygems_version: 1.3.6
|
72
81
|
signing_key:
|
73
|
-
specification_version:
|
82
|
+
specification_version: 3
|
74
83
|
summary: Ruby libcurl bindings
|
75
84
|
test_files:
|
76
|
-
- tests/
|
77
|
-
- tests/tc_curl_postfield.rb
|
85
|
+
- tests/alltests.rb
|
78
86
|
- tests/bug_curb_easy_blocks_ruby_threads.rb
|
87
|
+
- tests/bug_curb_easy_post_with_string_no_content_length_header.rb
|
88
|
+
- tests/bug_instance_post_differs_from_class_post.rb
|
89
|
+
- tests/bug_multi_segfault.rb
|
90
|
+
- tests/bug_postfields_crash.rb
|
91
|
+
- tests/bug_postfields_crash2.rb
|
92
|
+
- tests/bug_require_last_or_segfault.rb
|
79
93
|
- tests/bugtests.rb
|
80
|
-
- tests/
|
94
|
+
- tests/helper.rb
|
81
95
|
- tests/mem_check.rb
|
82
|
-
- tests/
|
83
|
-
- tests/bug_instance_post_differs_from_class_post.rb
|
96
|
+
- tests/require_last_or_segfault_script.rb
|
84
97
|
- tests/tc_curl_download.rb
|
85
|
-
- tests/alltests.rb
|
86
|
-
- tests/bug_curb_easy_post_with_string_no_content_length_header.rb
|
87
|
-
- tests/helper.rb
|
88
98
|
- tests/tc_curl_easy.rb
|
89
|
-
- tests/
|
90
|
-
- tests/
|
91
|
-
- tests/
|
92
|
-
- tests/bug_postfields_crash.rb
|
93
|
-
- tests/bug_issue20.rb
|
94
|
-
- tests/s.rb
|
99
|
+
- tests/tc_curl_multi.rb
|
100
|
+
- tests/tc_curl_postfield.rb
|
101
|
+
- tests/unittests.rb
|
data/tests/bug_issue20.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
-
require 'webrick'
|
3
|
-
class ::WEBrick::HTTPServer ; def access_log(config, req, res) ; end ; end
|
4
|
-
class ::WEBrick::BasicLog ; def log(level, data) ; end ; end
|
5
|
-
|
6
|
-
class BugIssue20 < Test::Unit::TestCase
|
7
|
-
def test_bug
|
8
|
-
Curl::Easy.new
|
9
|
-
end
|
10
|
-
end
|
data/tests/s.rb
DELETED