curb 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fd889c4132ef60a5341daea20eb772c6598de7b5
4
- data.tar.gz: 64d2ac621fa5d61716f3816699cbcb51d42fe014
2
+ SHA256:
3
+ metadata.gz: 7fd2f75fea9421bc6361cd44ea7343f42867eb1f87177e20598be60548e68a07
4
+ data.tar.gz: e30c3e3ba5e406d5517ad89f728f0c4a95682c9ec750fc93ce3fb381da5ac2cc
5
5
  SHA512:
6
- metadata.gz: 2d9e5ea00b7bf51cd58d25ddde708be4a8b298666008c3a738577ab7a6e725c479807b8d212653d90a37d756c3fe81b9f4b3bc9ab0bfe3cc8867834462cfbbf2
7
- data.tar.gz: 5c4bb1cb9b2638c0cc1cb159b5386b48e4e72c2759d9e6095c842c2f0f099380ffa4a0dafbf6ffd722b76493aaa6f6ec69132ad9164f1ddd4ce58eda1bb3f70f
6
+ metadata.gz: 6140588c19e97ce62b9c180fe07355f4781adfa84d3066402378b3abc995c5e23d1abc7458e4575a91964c8ea9fe572276a73a1dab8447de8607325a3fc9463f
7
+ data.tar.gz: 88ef4f8b18028a2d6e695a543a624d1cd468482cbc06c13b94c94504a30711b9ff0b1d45b7c2f0af145a9114d1bef1975e5889f63fdd0e6387c2c86912394270
@@ -7,7 +7,7 @@ Curb (probably CUrl-RuBy or something) provides Ruby-language bindings for the
7
7
  libcurl(3), a fully-featured client-side URL transfer library.
8
8
  cURL and libcurl live at [http://curl.haxx.se/](http://curl.haxx.se/) .
9
9
 
10
- Curb is a work-in-progress, and currently only supports libcurl's 'easy' and 'multi' modes.
10
+ Curb is a work-in-progress, and currently only supports libcurl's `easy` and `multi` modes.
11
11
 
12
12
  ## License
13
13
 
@@ -16,10 +16,26 @@ Ruby license. See the LICENSE file for the gory details.
16
16
 
17
17
  ## You will need
18
18
 
19
- * A working Ruby installation (2.1+)
20
- * A working (lib)curl installation, with development stuff (7.5+, tested with 7.19.x)
19
+ * A working Ruby installation (`1.8.7+` will work but `2.1+` preferred)
20
+ * A working libcurl development installation
21
+ (Ideally one of the versions listed in the compatibility chart below that maps to your `curb` version)
21
22
  * A sane build environment (e.g. gcc, make)
22
23
 
24
+ ## Version Compatibility chart
25
+
26
+ A **non-exhaustive** set of compatibility versions of the libcurl library
27
+ with this gem are as follows. (Note that these are only the ones that have been
28
+ tested and reported to work across a variety of platforms / rubies)
29
+
30
+ | Gem Version | Release Date | libcurl versions |
31
+ | ----------- | ----------- | ---------------- |
32
+ | 0.9.8 | Jan 2019 | 7.58 - 7.63 |
33
+ | 0.9.7 | Nov 2018 | 7.56 - 7.60 |
34
+ | 0.9.6 | May 2018 | 7.51 - 7.59 |
35
+ | 0.9.5 | May 2018 | 7.51 - 7.59 |
36
+ | 0.9.4 | Aug 2017 | 7.41 - 7.58 |
37
+ | 0.9.3 | Apr 2016 | 7.26 - 7.58 |
38
+
23
39
  ## Installation...
24
40
 
25
41
  ... will usually be as simple as:
@@ -31,6 +47,10 @@ the [development version of libcurl](http://curl.haxx.se/gknw.net/7.39.0/dist-w3
31
47
  line (alter paths to your curl location, but remember to use forward slashes):
32
48
 
33
49
  gem install curb --platform=ruby -- --with-curl-lib=C:/curl-7.39.0-devel-mingw32/lib --with-curl-include=C:/curl-7.39.0-devel-mingw32/include
50
+
51
+ Note that with Windows moving from one method of compiling to another as of Ruby `2.4` (DevKit -> MYSYS2),
52
+ the usage of Ruby `2.4+` with this gem on windows is unlikely to work. It is advised to use the
53
+ latest version of Ruby 2.3 available [HERE](https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.3.exe)
34
54
 
35
55
  Or, if you downloaded the archive:
36
56
 
data/ext/curb.h CHANGED
@@ -9,6 +9,13 @@
9
9
  #define __CURB_H
10
10
 
11
11
  #include <ruby.h>
12
+
13
+ #ifdef HAVE_RUBY_IO_H
14
+ #include "ruby/io.h"
15
+ #else
16
+ #include "rubyio.h" // ruby 1.8
17
+ #endif
18
+
12
19
  #include <curl/curl.h>
13
20
 
14
21
  #include "curb_config.h"
@@ -20,11 +27,11 @@
20
27
  #include "curb_macros.h"
21
28
 
22
29
  // These should be managed from the Rake 'release' task.
23
- #define CURB_VERSION "0.9.9"
24
- #define CURB_VER_NUM 909
30
+ #define CURB_VERSION "0.9.10"
31
+ #define CURB_VER_NUM 9010
25
32
  #define CURB_VER_MAJ 0
26
33
  #define CURB_VER_MIN 9
27
- #define CURB_VER_MIC 9
34
+ #define CURB_VER_MIC 10
28
35
  #define CURB_VER_PATCH 0
29
36
 
30
37
 
@@ -25,6 +25,12 @@ static VALUE rbstrAmp;
25
25
 
26
26
  VALUE cCurlEasy;
27
27
 
28
+ // for Ruby 1.8
29
+ #ifndef HAVE_RB_IO_STDIO_FILE
30
+ static FILE * rb_io_stdio_file(rb_io_t *fptr) {
31
+ return fptr->f;
32
+ }
33
+ #endif
28
34
 
29
35
  /* ================== CURL HANDLER FUNCS ==============*/
30
36
 
@@ -3451,6 +3457,7 @@ static VALUE ruby_curl_easy_last_result(VALUE self) {
3451
3457
  static VALUE ruby_curl_easy_set_opt(VALUE self, VALUE opt, VALUE val) {
3452
3458
  ruby_curl_easy *rbce;
3453
3459
  long option = NUM2LONG(opt);
3460
+ rb_io_t *open_f_ptr;
3454
3461
 
3455
3462
  Data_Get_Struct(self, ruby_curl_easy, rbce);
3456
3463
 
@@ -3592,6 +3599,13 @@ static VALUE ruby_curl_easy_set_opt(VALUE self, VALUE opt, VALUE val) {
3592
3599
  curl_easy_setopt(rbce->curl, HAVE_CURLOPT_HAPROXYPROTOCOL, NUM2LONG(val));
3593
3600
  break;
3594
3601
  #endif
3602
+ case CURLOPT_STDERR:
3603
+ // libcurl requires raw FILE pointer and this should be IO object in Ruby.
3604
+ // Tempfile or StringIO won't work.
3605
+ Check_Type(val, T_FILE);
3606
+ GetOpenFile(val, open_f_ptr);
3607
+ curl_easy_setopt(rbce->curl, CURLOPT_STDERR, rb_io_stdio_file(open_f_ptr));
3608
+ break;
3595
3609
  default:
3596
3610
  rb_raise(rb_eTypeError, "Curb unsupported option");
3597
3611
  }
@@ -427,6 +427,8 @@ test_for("curl_easy_escape", "CURL_EASY_ESCAPE", %{
427
427
 
428
428
  have_func('rb_thread_blocking_region')
429
429
  have_header('ruby/thread.h') && have_func('rb_thread_call_without_gvl', 'ruby/thread.h')
430
+ have_header('ruby/io.h')
431
+ have_func('rb_io_stdio_file')
430
432
 
431
433
  create_header('curb_config.h')
432
434
  create_makefile('curb_core')
@@ -2,6 +2,7 @@
2
2
  # Copyright (c)2006 Ross Bamford. See LICENSE.
3
3
  $CURB_TESTING = true
4
4
  require 'uri'
5
+ require 'stringio'
5
6
 
6
7
  $TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
7
8
  $EXTDIR = File.join($TOPDIR, 'ext')
@@ -10,6 +10,66 @@ class TestCurbCurlEasy < Test::Unit::TestCase
10
10
  Curl.reset
11
11
  end
12
12
 
13
+ def test_curlopt_stderr_with_file
14
+ # does not work with Tempfile directly
15
+ path = Tempfile.new('curb_test_curlopt_stderr').path
16
+ File.open(path, 'w') do |file|
17
+ easy = Curl::Easy.new(TestServlet.url)
18
+ easy.verbose = true
19
+ easy.setopt(Curl::CURLOPT_STDERR, file)
20
+ easy.perform
21
+ end
22
+ output = File.read(path)
23
+
24
+ assert_match('HTTP/1.1 200 OK ', output)
25
+ assert_match('Host: 127.0.0.1:9129', output)
26
+ end
27
+
28
+ def test_curlopt_stderr_with_io
29
+ path = Tempfile.new('curb_test_curlopt_stderr').path
30
+ fd = IO.sysopen(path, 'w')
31
+ io = IO.for_fd(fd)
32
+
33
+ easy = Curl::Easy.new(TestServlet.url)
34
+ easy.verbose = true
35
+ easy.setopt(Curl::CURLOPT_STDERR, io)
36
+ easy.perform
37
+
38
+
39
+ output = File.read(path)
40
+
41
+ assert_match(output, 'HTTP/1.1 200 OK')
42
+ assert_match(output, 'Host: 127.0.0.1:9129')
43
+ end
44
+
45
+ def test_curlopt_stderr_fails_with_tempdir
46
+ Tempfile.open('curb_test_curlopt_stderr') do |tempfile|
47
+ easy = Curl::Easy.new(TestServlet.url)
48
+
49
+ assert_raise(TypeError) do
50
+ easy.setopt(Curl::CURLOPT_STDERR, tempfile)
51
+ end
52
+ end
53
+ end
54
+
55
+ def test_curlopt_stderr_fails_with_stringio
56
+ stringio = StringIO.new
57
+ easy = Curl::Easy.new(TestServlet.url)
58
+
59
+ assert_raise(TypeError) do
60
+ easy.setopt(Curl::CURLOPT_STDERR, stringio)
61
+ end
62
+ end
63
+
64
+ def test_curlopt_stderr_fails_with_string
65
+ string = String.new
66
+ easy = Curl::Easy.new(TestServlet.url)
67
+
68
+ assert_raise(TypeError) do
69
+ easy.setopt(Curl::CURLOPT_STDERR, string)
70
+ end
71
+ end
72
+
13
73
  def test_exception
14
74
  begin
15
75
  Curl.get('NOT_FOUND_URL')
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.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Bamford
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-07 00:00:00.000000000 Z
12
+ date: 2019-04-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
15
15
  for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
@@ -72,7 +72,7 @@ files:
72
72
  - tests/timeout.rb
73
73
  - tests/timeout_server.rb
74
74
  - tests/unittests.rb
75
- homepage: http://curb.rubyforge.org/
75
+ homepage: https://github.com/taf2/curb
76
76
  licenses:
77
77
  - MIT
78
78
  metadata: {}
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project: curb
98
- rubygems_version: 2.5.2
98
+ rubygems_version: 2.7.9
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Ruby libcurl bindings