curb 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +5 -5
- data/ext/curb.h +4 -4
- data/ext/curb_easy.c +2 -0
- data/ext/curb_errors.c +7 -0
- data/ext/extconf.rb +3 -0
- data/lib/curl.rb +4 -6
- data/tests/helper.rb +1 -1
- data/tests/tc_curl.rb +30 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 074fa1f2330b83e471e524dcbef1f5ef869fd352
|
4
|
+
data.tar.gz: 52abfef2028f532f2070406117f66dc779913ccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eee7cc31175d70a6720c9f0f86958644e7fd9f179e82cc0b3a90e70dc3e5c4caa2cd0db06a3e1350ae88ef7c030e14e8d2c6e6d2dfba9e8c9b8872fe56fa421
|
7
|
+
data.tar.gz: 3191554e99e528b7e59801ad5322661fe95ebcfe83ced7f6658f1eda2ee6a2546b990b4c6ff9182a4242f15556443422dcc9be4f4005dfe0c72cb13da517d1b6
|
data/README.markdown
CHANGED
@@ -16,7 +16,7 @@ Ruby license. See the LICENSE file for the gory details.
|
|
16
16
|
|
17
17
|
## You will need
|
18
18
|
|
19
|
-
* A working Ruby installation (
|
19
|
+
* A working Ruby installation (2.1+)
|
20
20
|
* A working (lib)curl installation, with development stuff (7.5+, tested with 7.19.x)
|
21
21
|
* A sane build environment (e.g. gcc, make)
|
22
22
|
|
@@ -30,7 +30,7 @@ On Windows, make sure you're using the [DevKit](http://rubyinstaller.org/downloa
|
|
30
30
|
the [development version of libcurl](http://curl.haxx.se/gknw.net/7.39.0/dist-w32/curl-7.39.0-devel-mingw32.zip). Unzip, then run this in your command
|
31
31
|
line (alter paths to your curl location, but remember to use forward slashes):
|
32
32
|
|
33
|
-
gem install curb --platform=ruby -- --with-curl-lib=C:/curl-7.39.0-devel-mingw32/
|
33
|
+
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
|
34
34
|
|
35
35
|
Or, if you downloaded the archive:
|
36
36
|
|
@@ -134,9 +134,9 @@ c.perform
|
|
134
134
|
### HTTP "insecure" SSL connections (like curl -k, --insecure) to avoid Curl::Err::SSLCACertificateError:
|
135
135
|
|
136
136
|
```ruby
|
137
|
-
|
138
|
-
|
139
|
-
|
137
|
+
c = Curl::Easy.new("https://github.com/")
|
138
|
+
c.ssl_verify_peer = false
|
139
|
+
c.perform
|
140
140
|
```
|
141
141
|
|
142
142
|
### Supplying custom handlers:
|
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.9.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.9.7"
|
24
|
+
#define CURB_VER_NUM 907
|
25
25
|
#define CURB_VER_MAJ 0
|
26
|
-
#define CURB_VER_MIN
|
27
|
-
#define CURB_VER_MIC
|
26
|
+
#define CURB_VER_MIN 9
|
27
|
+
#define CURB_VER_MIC 7
|
28
28
|
#define CURB_VER_PATCH 0
|
29
29
|
|
30
30
|
|
data/ext/curb_easy.c
CHANGED
@@ -2346,6 +2346,7 @@ VALUE ruby_curl_easy_setup(ruby_curl_easy *rbce) {
|
|
2346
2346
|
}
|
2347
2347
|
}
|
2348
2348
|
|
2349
|
+
#if HAVE_CURLOPT_RESOLVE
|
2349
2350
|
/* Setup resolve list if necessary */
|
2350
2351
|
if (!rb_easy_nil("resolve")) {
|
2351
2352
|
if (rb_easy_type_check("resolve", T_ARRAY)) {
|
@@ -2357,6 +2358,7 @@ VALUE ruby_curl_easy_setup(ruby_curl_easy *rbce) {
|
|
2357
2358
|
curl_easy_setopt(curl, CURLOPT_RESOLVE, *rslv);
|
2358
2359
|
}
|
2359
2360
|
}
|
2361
|
+
#endif
|
2360
2362
|
|
2361
2363
|
return Qnil;
|
2362
2364
|
}
|
data/ext/curb_errors.c
CHANGED
@@ -307,9 +307,11 @@ VALUE rb_curl_easy_error(CURLcode code) {
|
|
307
307
|
exclz = eCurlErrObsolete;
|
308
308
|
break;
|
309
309
|
#endif
|
310
|
+
#if LIBCURL_VERSION_NUM < 0x073e00
|
310
311
|
case CURLE_SSL_PEER_CERTIFICATE: /* 51 - peer's certificate wasn't ok */
|
311
312
|
exclz = eCurlErrSSLPeerCertificate;
|
312
313
|
break;
|
314
|
+
#endif
|
313
315
|
case CURLE_GOT_NOTHING: /* 52 - when this is a specific error */
|
314
316
|
exclz = eCurlErrGotNothing;
|
315
317
|
break;
|
@@ -334,8 +336,13 @@ VALUE rb_curl_easy_error(CURLcode code) {
|
|
334
336
|
case CURLE_SSL_CIPHER: /* 59 - couldn't use specified cipher */
|
335
337
|
exclz = eCurlErrSSLCipher;
|
336
338
|
break;
|
339
|
+
#if LIBCURL_VERSION_NUM >= 0x073e00
|
340
|
+
case CURLE_PEER_FAILED_VERIFICATION: /* 60 - problem with the CA cert (path?) */
|
341
|
+
exclz = eCurlErrSSLPeerCertificate;
|
342
|
+
#else
|
337
343
|
case CURLE_SSL_CACERT: /* 60 - problem with the CA cert (path?) */
|
338
344
|
exclz = eCurlErrSSLCACertificate;
|
345
|
+
#endif
|
339
346
|
break;
|
340
347
|
case CURLE_BAD_CONTENT_ENCODING: /* 61 - Unrecognized transfer encoding */
|
341
348
|
exclz = eCurlErrBadContentEncoding;
|
data/ext/extconf.rb
CHANGED
@@ -102,6 +102,9 @@ have_constant "curle_send_fail_rewind"
|
|
102
102
|
have_constant "curle_ssl_engine_initfailed"
|
103
103
|
have_constant "curle_login_denied"
|
104
104
|
|
105
|
+
# older than 7.10.0
|
106
|
+
have_constant "curlopt_nosignal"
|
107
|
+
|
105
108
|
# older than 7.16.0
|
106
109
|
have_constant "curlmopt_pipelining"
|
107
110
|
|
data/lib/curl.rb
CHANGED
@@ -48,13 +48,11 @@ module Curl
|
|
48
48
|
|
49
49
|
def self.urlalize(url, params={})
|
50
50
|
uri = URI(url)
|
51
|
+
# early return if we didn't specify any extra params
|
52
|
+
return uri.to_s if (params || {}).empty?
|
53
|
+
|
51
54
|
params_query = URI.encode_www_form(params || {})
|
52
|
-
|
53
|
-
if !(uri.query.nil? || uri.query.empty?) && !params_query.empty?
|
54
|
-
uri.query = "#{uri.query}&#{params_query}"
|
55
|
-
else
|
56
|
-
uri.query = "#{uri.query}#{params_query}"
|
57
|
-
end
|
55
|
+
uri.query = [uri.query.to_s, params_query].reject(&:empty?).join('&')
|
58
56
|
uri.to_s
|
59
57
|
end
|
60
58
|
|
data/tests/helper.rb
CHANGED
@@ -97,7 +97,7 @@ class TestServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
97
97
|
if params and params['s'] == '500'
|
98
98
|
res.status = 500
|
99
99
|
elsif params and params['c']
|
100
|
-
cookie = URI.
|
100
|
+
cookie = URI.decode_www_form_component(params['c']).split('=')
|
101
101
|
res.cookies << WEBrick::Cookie.new(*cookie)
|
102
102
|
else
|
103
103
|
respond_with("POST\n#{req.body}",req,res)
|
data/tests/tc_curl.rb
CHANGED
@@ -31,6 +31,36 @@ class TestCurl < Test::Unit::TestCase
|
|
31
31
|
assert_equal "OPTIONSfoo=bar", curl.body_str
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_urlalize_without_extra_params
|
35
|
+
url_no_params = 'http://localhost/test'
|
36
|
+
url_with_params = 'http://localhost/test?a=1'
|
37
|
+
|
38
|
+
assert_equal(url_no_params, Curl.urlalize(url_no_params))
|
39
|
+
assert_equal(url_with_params, Curl.urlalize(url_with_params))
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_urlalize_with_nil_as_params
|
43
|
+
url = 'http://localhost/test'
|
44
|
+
assert_equal(url, Curl.urlalize(url, nil))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_urlalize_with_extra_params
|
48
|
+
url_no_params = 'http://localhost/test'
|
49
|
+
url_with_params = 'http://localhost/test?a=1'
|
50
|
+
extra_params = { :b => 2 }
|
51
|
+
|
52
|
+
expected_url_no_params = 'http://localhost/test?b=2'
|
53
|
+
expected_url_with_params = 'http://localhost/test?a=1&b=2'
|
54
|
+
|
55
|
+
assert_equal(expected_url_no_params, Curl.urlalize(url_no_params, extra_params))
|
56
|
+
assert_equal(expected_url_with_params, Curl.urlalize(url_with_params, extra_params))
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_urlalize_does_not_strip_trailing_?
|
60
|
+
url_empty_params = 'http://localhost/test?'
|
61
|
+
assert_equal(url_empty_params, Curl.urlalize(url_empty_params))
|
62
|
+
end
|
63
|
+
|
34
64
|
include TestServerMethods
|
35
65
|
|
36
66
|
def setup
|
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.
|
4
|
+
version: 0.9.7
|
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: 2018-
|
12
|
+
date: 2018-11-26 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
|