curb 0.7.3 → 0.7.4

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 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.7.3"
24
- #define CURB_VER_NUM 703
23
+ #define CURB_VERSION "0.7.4"
24
+ #define CURB_VER_NUM 704
25
25
  #define CURB_VER_MAJ 0
26
26
  #define CURB_VER_MIN 7
27
- #define CURB_VER_MIC 3
27
+ #define CURB_VER_MIC 4
28
28
  #define CURB_VER_PATCH 0
29
29
 
30
30
 
@@ -2287,6 +2287,40 @@ static VALUE ruby_curl_easy_set_head_option(VALUE self, VALUE onoff) {
2287
2287
 
2288
2288
  return onoff;
2289
2289
  }
2290
+ /*
2291
+ *call-seq:
2292
+ *
2293
+ * easy = Curl::Easy.new("url")
2294
+ * easy.version = Curl::HTTP_1_1
2295
+ * easy.version = Curl::HTTP_1_0
2296
+ * easy.version = Curl::HTTP_NONE
2297
+ *
2298
+ */
2299
+ static VALUE ruby_curl_easy_set_version(VALUE self, VALUE version) {
2300
+ ruby_curl_easy *rbce;
2301
+ //fprintf(stderr,"CURL_HTTP_VERSION_1_1: %d, CURL_HTTP_VERSION_1_0: %d, CURL_HTTP_VERSION_NONE: %d\n", CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_NONE);
2302
+
2303
+ Data_Get_Struct(self, ruby_curl_easy, rbce);
2304
+
2305
+ curl_easy_setopt(rbce->curl, CURLOPT_HTTP_VERSION, FIX2INT(version));
2306
+
2307
+ return version;
2308
+ }
2309
+ /*
2310
+ * call-seq:
2311
+ *
2312
+ * easy = Curl::Easy.new
2313
+ * easy.nosignal = true
2314
+ */
2315
+ static VALUE ruby_curl_easy_set_nosignal(VALUE self, VALUE onoff) {
2316
+ ruby_curl_easy *rbce;
2317
+
2318
+ Data_Get_Struct(self, ruby_curl_easy, rbce);
2319
+
2320
+ curl_easy_setopt(rbce->curl, CURLOPT_NOSIGNAL, FIX2INT(onoff));
2321
+
2322
+ return onoff;
2323
+ }
2290
2324
  /*
2291
2325
  *call-seq:
2292
2326
  * easy = Curl::Easy.new("url") do|c|
@@ -3253,6 +3287,11 @@ void init_curb_easy() {
3253
3287
  rb_define_method(cCurlEasy, "http_put", ruby_curl_easy_perform_put, 1);
3254
3288
  rb_define_method(cCurlEasy, "head=", ruby_curl_easy_set_head_option, 1);
3255
3289
  rb_define_method(cCurlEasy, "delete=", ruby_curl_easy_set_delete_option, 1);
3290
+ rb_define_method(cCurlEasy, "version=", ruby_curl_easy_set_version, 1);
3291
+ rb_define_const(mCurl, "HTTP_1_1", LONG2NUM(CURL_HTTP_VERSION_1_1));
3292
+ rb_define_const(mCurl, "HTTP_1_0", LONG2NUM(CURL_HTTP_VERSION_1_0));
3293
+ rb_define_const(mCurl, "HTTP_NONE", LONG2NUM(CURL_HTTP_VERSION_NONE));
3294
+ rb_define_method(cCurlEasy, "nosignal=", ruby_curl_easy_set_nosignal, 1);
3256
3295
 
3257
3296
  /* Post-perform info methods */
3258
3297
  rb_define_method(cCurlEasy, "body_str", ruby_curl_easy_body_str_get, 0);
@@ -428,9 +428,9 @@ static VALUE ruby_curl_postfield_to_str(VALUE self) {
428
428
  Data_Get_Struct(self, ruby_curl_postfield, rbcpf);
429
429
 
430
430
  if ((rbcpf->local_file == Qnil) && (rbcpf->remote_file == Qnil)) {
431
- if (rbcpf->name != Qnil) {
431
+ if (rbcpf->name != Qnil && rb_type(rbcpf->name) == T_STRING) {
432
432
 
433
- char *tmpchrs = curl_escape(StringValuePtr(rbcpf->name), RSTRING_LEN(StringValue(rbcpf->name)));
433
+ char *tmpchrs = curl_escape(StringValuePtr(rbcpf->name), RSTRING_LEN(rbcpf->name));
434
434
 
435
435
  if (!tmpchrs) {
436
436
  rb_raise(eCurlErrInvalidPostField, "Failed to url-encode name `%s'", tmpchrs);
@@ -471,7 +471,7 @@ static VALUE ruby_curl_postfield_to_str(VALUE self) {
471
471
  rb_raise(eCurlErrInvalidPostField, "Cannot convert unnamed field to string %s:%d", __FILE__, __LINE__);
472
472
  }
473
473
  } else {
474
- rb_raise(eCurlErrInvalidPostField, "Cannot convert non-content field to string %s:%d", __FILE__, __LINE__);
474
+ rb_raise(eCurlErrInvalidPostField, "Local file and remote file are both nil %s:%d", __FILE__, __LINE__);
475
475
  }
476
476
 
477
477
  return result;
@@ -731,6 +731,17 @@ class TestCurbCurlEasy < Test::Unit::TestCase
731
731
  easy.http_get
732
732
  end
733
733
 
734
+ def test_easy_use_http_versions
735
+ easy = Curl::Easy.new
736
+ easy.url = TestServlet.url + "?query=foo"
737
+ #puts "http none: #{Curl::HTTP_NONE.inspect}"
738
+ #puts "http1.0: #{Curl::HTTP_1_0.inspect}"
739
+ #puts "http1.1: #{Curl::HTTP_1_1.inspect}"
740
+ easy.version = Curl::HTTP_1_1
741
+ #easy.verbose = true
742
+ easy.http_get
743
+ end
744
+
734
745
  include TestServerMethods
735
746
 
736
747
  def setup
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 3
9
- version: 0.7.3
8
+ - 4
9
+ version: 0.7.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ross Bamford
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-18 00:00:00 -04:00
18
+ date: 2010-06-04 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -34,21 +34,21 @@ files:
34
34
  - Rakefile
35
35
  - doc.rb
36
36
  - ext/extconf.rb
37
- - lib/curb.rb
38
37
  - lib/curl.rb
38
+ - lib/curb.rb
39
39
  - ext/curb.c
40
+ - ext/curb_upload.c
41
+ - ext/curb_postfield.c
40
42
  - ext/curb_easy.c
41
- - ext/curb_errors.c
42
43
  - ext/curb_multi.c
43
- - ext/curb_postfield.c
44
- - ext/curb_upload.c
45
- - ext/curb.h
46
- - ext/curb_easy.h
44
+ - ext/curb_errors.c
47
45
  - ext/curb_errors.h
48
- - ext/curb_macros.h
49
46
  - ext/curb_multi.h
47
+ - ext/curb.h
48
+ - ext/curb_easy.h
50
49
  - ext/curb_postfield.h
51
50
  - ext/curb_upload.h
51
+ - ext/curb_macros.h
52
52
  has_rdoc: true
53
53
  homepage: http://curb.rubyforge.org/
54
54
  licenses: []
@@ -82,20 +82,20 @@ signing_key:
82
82
  specification_version: 3
83
83
  summary: Ruby libcurl bindings
84
84
  test_files:
85
- - tests/alltests.rb
86
- - tests/bug_curb_easy_blocks_ruby_threads.rb
87
- - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
85
+ - tests/bugtests.rb
86
+ - tests/mem_check.rb
87
+ - tests/bug_require_last_or_segfault.rb
88
+ - tests/helper.rb
89
+ - tests/tc_curl_postfield.rb
88
90
  - tests/bug_instance_post_differs_from_class_post.rb
89
91
  - tests/bug_multi_segfault.rb
92
+ - tests/alltests.rb
90
93
  - tests/bug_postfields_crash.rb
91
- - tests/bug_postfields_crash2.rb
92
- - tests/bug_require_last_or_segfault.rb
93
- - tests/bugtests.rb
94
- - tests/helper.rb
95
- - tests/mem_check.rb
96
94
  - tests/require_last_or_segfault_script.rb
95
+ - tests/bug_postfields_crash2.rb
96
+ - tests/unittests.rb
97
+ - tests/tc_curl_multi.rb
98
+ - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
97
99
  - tests/tc_curl_download.rb
98
100
  - tests/tc_curl_easy.rb
99
- - tests/tc_curl_multi.rb
100
- - tests/tc_curl_postfield.rb
101
- - tests/unittests.rb
101
+ - tests/bug_curb_easy_blocks_ruby_threads.rb