curb 0.9.7 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.markdown +54 -5
- data/Rakefile +33 -20
- data/ext/banned.h +32 -0
- data/ext/curb.c +170 -8
- data/ext/curb.h +18 -5
- data/ext/curb_easy.c +321 -43
- data/ext/curb_easy.h +6 -0
- data/ext/curb_multi.c +136 -171
- data/ext/curb_multi.h +0 -1
- data/ext/curb_postfield.c +7 -7
- data/ext/extconf.rb +45 -0
- data/lib/curb.rb +1 -0
- data/lib/curl/easy.rb +14 -7
- data/lib/curl/multi.rb +42 -3
- data/lib/curl.rb +12 -3
- data/tests/bug_issue277.rb +32 -0
- data/tests/helper.rb +79 -1
- data/tests/tc_curl_easy.rb +118 -16
- data/tests/tc_curl_maxfilesize.rb +12 -0
- data/tests/tc_curl_multi.rb +109 -5
- data/tests/tc_curl_postfield.rb +29 -29
- data/tests/tc_curl_protocols.rb +37 -0
- data/tests/timeout.rb +21 -5
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b452d79ee28ee380d6741f39f9fbf826a33a46d473fa4444edb6a56a122af8f8
|
4
|
+
data.tar.gz: '094812699e5b64584d6dd02a17b16884ee696a20dbf324c05498a46509e39b16'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df71c1a4eb7896f89da78a79ba9160d5606aa235b89544e08630c558a7cebb1220ec026f99f404915f52e15162cf2c988a66abe04932c3cd1104a1784bd3056
|
7
|
+
data.tar.gz: '08fba6b5b9a9404f839e4110b0d485e1595be36554345abb88a05482183204f4e0f13001a7731db75e89ca890bfa8ad19ccced63dfecd0e766f1b825ff5e9f1a'
|
data/README.markdown
CHANGED
@@ -5,21 +5,60 @@
|
|
5
5
|
|
6
6
|
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
|
-
cURL and libcurl live at [
|
8
|
+
cURL and libcurl live at [https://curl.se/libcurl/](https://curl.se/libcurl/) .
|
9
9
|
|
10
|
-
Curb is a work-in-progress, and currently only supports libcurl's
|
10
|
+
Curb is a work-in-progress, and currently only supports libcurl's `easy` and `multi` modes.
|
11
11
|
|
12
12
|
## License
|
13
13
|
|
14
14
|
Curb is copyright (c)2006 Ross Bamford, and released under the terms of the
|
15
15
|
Ruby license. See the LICENSE file for the gory details.
|
16
16
|
|
17
|
+
## Easy mode
|
18
|
+
|
19
|
+
Get stuff
|
20
|
+
```
|
21
|
+
res = Curl.get("https://www.google.com/")
|
22
|
+
puts res.response_code
|
23
|
+
puts res.header_str
|
24
|
+
puts res.body
|
25
|
+
```
|
26
|
+
|
27
|
+
Post stuff
|
28
|
+
```
|
29
|
+
res = Curl.post("https://your-server.com/endpoint", {post: "this"}.to_json) {|http|
|
30
|
+
http.headers["Content-Type"] = "application/json"
|
31
|
+
}
|
32
|
+
puts res.response_code
|
33
|
+
puts res.header_str
|
34
|
+
puts res.body
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
|
17
39
|
## You will need
|
18
40
|
|
19
|
-
* A working Ruby installation (2.1
|
20
|
-
* A working
|
41
|
+
* A working Ruby installation (`2.0.0+` will work but `2.1+` preferred) (it's possible it still works with 1.8.7 but you'd have to tell me if not...)
|
42
|
+
* A working libcurl development installation
|
43
|
+
(Ideally one of the versions listed in the compatibility chart below that maps to your `curb` version)
|
21
44
|
* A sane build environment (e.g. gcc, make)
|
22
45
|
|
46
|
+
## Version Compatibility chart
|
47
|
+
|
48
|
+
A **non-exhaustive** set of compatibility versions of the libcurl library
|
49
|
+
with this gem are as follows. (Note that these are only the ones that have been
|
50
|
+
tested and reported to work across a variety of platforms / rubies)
|
51
|
+
|
52
|
+
| Gem Version | Release Date | libcurl versions |
|
53
|
+
| ----------- | ----------- | ---------------- |
|
54
|
+
| 1.0.0 | Jan 2022 | 7.58 - 7.81 |
|
55
|
+
| 0.9.8 | Jan 2019 | 7.58 - 7.81 |
|
56
|
+
| 0.9.7 | Nov 2018 | 7.56 - 7.60 |
|
57
|
+
| 0.9.6 | May 2018 | 7.51 - 7.59 |
|
58
|
+
| 0.9.5 | May 2018 | 7.51 - 7.59 |
|
59
|
+
| 0.9.4 | Aug 2017 | 7.41 - 7.58 |
|
60
|
+
| 0.9.3 | Apr 2016 | 7.26 - 7.58 |
|
61
|
+
|
23
62
|
## Installation...
|
24
63
|
|
25
64
|
... will usually be as simple as:
|
@@ -27,10 +66,14 @@ Ruby license. See the LICENSE file for the gory details.
|
|
27
66
|
$ gem install curb
|
28
67
|
|
29
68
|
On Windows, make sure you're using the [DevKit](http://rubyinstaller.org/downloads/) and
|
30
|
-
the [development version of libcurl](http://curl.
|
69
|
+
the [development version of libcurl](http://curl.se/gknw.net/7.39.0/dist-w32/curl-7.39.0-devel-mingw32.zip). Unzip, then run this in your command
|
31
70
|
line (alter paths to your curl location, but remember to use forward slashes):
|
32
71
|
|
33
72
|
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
|
73
|
+
|
74
|
+
Note that with Windows moving from one method of compiling to another as of Ruby `2.4` (DevKit -> MYSYS2),
|
75
|
+
the usage of Ruby `2.4+` with this gem on windows is unlikely to work. It is advised to use the
|
76
|
+
latest version of Ruby 2.3 available [HERE](https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.3.exe)
|
34
77
|
|
35
78
|
Or, if you downloaded the archive:
|
36
79
|
|
@@ -47,6 +90,12 @@ expand on the above instructions, please report the issue at http://github.com/t
|
|
47
90
|
|
48
91
|
On Ubuntu, the dependencies can be satisfied by installing the following packages:
|
49
92
|
|
93
|
+
18.04 and onwards
|
94
|
+
|
95
|
+
$ sudo apt-get install libcurl4 libcurl3-gnutls libcurl4-openssl-dev
|
96
|
+
|
97
|
+
< 18.04
|
98
|
+
|
50
99
|
$ sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
|
51
100
|
|
52
101
|
On RedHat:
|
data/Rakefile
CHANGED
@@ -2,11 +2,6 @@
|
|
2
2
|
#
|
3
3
|
require 'rake/clean'
|
4
4
|
require 'rake/testtask'
|
5
|
-
begin
|
6
|
-
require 'rdoc/task'
|
7
|
-
rescue LoadError => e
|
8
|
-
require 'rake/rdoctask'
|
9
|
-
end
|
10
5
|
|
11
6
|
CLEAN.include '**/*.o'
|
12
7
|
CLEAN.include "**/*.#{(defined?(RbConfig) ? RbConfig : Config)::MAKEFILE_CONFIG['DLEXT']}"
|
@@ -15,6 +10,22 @@ CLOBBER.include '**/*.log'
|
|
15
10
|
CLOBBER.include '**/Makefile'
|
16
11
|
CLOBBER.include '**/extconf.h'
|
17
12
|
|
13
|
+
# Not available for really old rubies, but that's ok.
|
14
|
+
begin
|
15
|
+
require 'pry'
|
16
|
+
rescue LoadError
|
17
|
+
puts "Failed to load pry."
|
18
|
+
end
|
19
|
+
|
20
|
+
# Load support ruby and rake files (in this order)
|
21
|
+
Dir.glob('tasks/*.rb').each { |r| load r}
|
22
|
+
Dir.glob('tasks/*.rake').each { |r| load r}
|
23
|
+
|
24
|
+
desc 'Print Ruby major version (ie "2_5")'
|
25
|
+
task :ruby_version do
|
26
|
+
print current_ruby_major
|
27
|
+
end
|
28
|
+
|
18
29
|
def announce(msg='')
|
19
30
|
$stderr.puts msg
|
20
31
|
end
|
@@ -43,26 +54,23 @@ end
|
|
43
54
|
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
|
44
55
|
MAKECMD = ENV['MAKE_CMD'] || make_program
|
45
56
|
MAKEOPTS = ENV['MAKE_OPTS'] || ''
|
46
|
-
|
47
57
|
CURB_SO = "ext/curb_core.#{(defined?(RbConfig) ? RbConfig : Config)::MAKEFILE_CONFIG['DLEXT']}"
|
48
58
|
|
49
59
|
file 'ext/Makefile' => 'ext/extconf.rb' do
|
50
|
-
|
51
|
-
|
52
|
-
|
60
|
+
shell(['ruby', 'extconf.rb', ENV['EXTCONF_OPTS'].to_s],
|
61
|
+
{ :live_stdout => STDOUT , :cwd => "#{Dir.pwd}/ext" }
|
62
|
+
).error!
|
53
63
|
end
|
54
64
|
|
55
65
|
def make(target = '')
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
66
|
+
shell(["#{MAKECMD}", "#{MAKEOPTS}", "#{target}"].reject(&:empty?),
|
67
|
+
{ :live_stdout => STDOUT, :cwd => "#{Dir.pwd}/ext" }
|
68
|
+
).error!
|
60
69
|
end
|
61
70
|
|
62
71
|
# Let make handle dependencies between c/o/so - we'll just run it.
|
63
72
|
file CURB_SO => (['ext/Makefile'] + Dir['ext/*.c'] + Dir['ext/*.h']) do
|
64
|
-
|
65
|
-
fail "Make failed (status #{m})" unless m == 0
|
73
|
+
make
|
66
74
|
end
|
67
75
|
|
68
76
|
desc "Compile the shared object"
|
@@ -70,8 +78,7 @@ task :compile => [CURB_SO]
|
|
70
78
|
|
71
79
|
desc "Install to your site_ruby directory"
|
72
80
|
task :install do
|
73
|
-
|
74
|
-
fail "Make install failed (status #{m})" unless m == 0
|
81
|
+
make 'install'
|
75
82
|
end
|
76
83
|
|
77
84
|
# Test Tasks ---------------------------------------------------------
|
@@ -89,12 +96,12 @@ if ENV['RELTEST']
|
|
89
96
|
else
|
90
97
|
task :alltests => [:unittests, :bugtests]
|
91
98
|
end
|
92
|
-
|
99
|
+
|
93
100
|
Rake::TestTask.new(:unittests) do |t|
|
94
101
|
t.test_files = FileList['tests/tc_*.rb']
|
95
102
|
t.verbose = false
|
96
103
|
end
|
97
|
-
|
104
|
+
|
98
105
|
Rake::TestTask.new(:bugtests) do |t|
|
99
106
|
t.test_files = FileList['tests/bug_*.rb']
|
100
107
|
t.verbose = false
|
@@ -136,6 +143,12 @@ end
|
|
136
143
|
|
137
144
|
desc "Publish the RDoc documentation to project web site"
|
138
145
|
task :doc_upload => [ :doc ] do
|
146
|
+
begin
|
147
|
+
require 'rdoc/task'
|
148
|
+
rescue LoadError => e
|
149
|
+
require 'rake/rdoctask'
|
150
|
+
end
|
151
|
+
|
139
152
|
if ENV['RELTEST']
|
140
153
|
announce "Release Task Testing, skipping doc upload"
|
141
154
|
else
|
@@ -170,7 +183,7 @@ else
|
|
170
183
|
spec_source = File.read File.join(File.dirname(__FILE__),'curb.gemspec')
|
171
184
|
spec = nil
|
172
185
|
# see: http://gist.github.com/16215
|
173
|
-
Thread.new { spec = eval("
|
186
|
+
Thread.new { spec = eval("#{spec_source}") }.join
|
174
187
|
spec.validate
|
175
188
|
Gem::Package.build(spec)
|
176
189
|
end
|
data/ext/banned.h
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#ifndef BANNED_H
|
2
|
+
#define BANNED_H
|
3
|
+
|
4
|
+
/*
|
5
|
+
* This header lists functions that have been banned from our code base,
|
6
|
+
* because they're too easy to misuse (and even if used correctly,
|
7
|
+
* complicate audits). Including this header turns them into compile-time
|
8
|
+
* errors.
|
9
|
+
*/
|
10
|
+
|
11
|
+
#define BANNED(func) sorry_##func##_is_a_banned_function
|
12
|
+
|
13
|
+
#undef strcpy
|
14
|
+
#define strcpy(x,y) BANNED(strcpy)
|
15
|
+
#undef strcat
|
16
|
+
#define strcat(x,y) BANNED(strcat)
|
17
|
+
#undef strncpy
|
18
|
+
#define strncpy(x,y,n) BANNED(strncpy)
|
19
|
+
#undef strncat
|
20
|
+
#define strncat(x,y,n) BANNED(strncat)
|
21
|
+
|
22
|
+
#undef sprintf
|
23
|
+
#undef vsprintf
|
24
|
+
#ifdef HAVE_VARIADIC_MACROS
|
25
|
+
#define sprintf(...) BANNED(sprintf)
|
26
|
+
#define vsprintf(...) BANNED(vsprintf)
|
27
|
+
#else
|
28
|
+
#define sprintf(buf,fmt,arg) BANNED(sprintf)
|
29
|
+
#define vsprintf(buf,fmt,arg) BANNED(sprintf)
|
30
|
+
#endif
|
31
|
+
|
32
|
+
#endif /* BANNED_H */
|
data/ext/curb.c
CHANGED
@@ -235,12 +235,16 @@ static VALUE ruby_curl_http2_q(VALUE mod) {
|
|
235
235
|
#endif
|
236
236
|
}
|
237
237
|
|
238
|
+
static void finalize_curb_core(VALUE data) {
|
239
|
+
curl_global_cleanup();
|
240
|
+
}
|
241
|
+
|
238
242
|
void Init_curb_core() {
|
239
|
-
// TODO we need to call curl_global_cleanup at exit!
|
240
243
|
curl_version_info_data *ver;
|
241
244
|
VALUE curlver, curllongver, curlvernum;
|
242
245
|
|
243
246
|
curl_global_init(CURL_GLOBAL_ALL);
|
247
|
+
rb_set_end_proc(finalize_curb_core, Qnil);
|
244
248
|
ver = curl_version_info(CURLVERSION_NOW);
|
245
249
|
|
246
250
|
mCurl = rb_define_module("Curl");
|
@@ -292,18 +296,26 @@ void Init_curb_core() {
|
|
292
296
|
#endif
|
293
297
|
|
294
298
|
#ifdef CURL_VERSION_SSL
|
295
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT",
|
299
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT", LONG2NUM(CURL_SSLVERSION_DEFAULT));
|
300
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_DEFAULT", LONG2NUM(CURL_SSLVERSION_MAX_DEFAULT));
|
296
301
|
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1", LONG2NUM(CURL_SSLVERSION_TLSv1));
|
297
302
|
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", LONG2NUM(CURL_SSLVERSION_SSLv2));
|
298
303
|
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", LONG2NUM(CURL_SSLVERSION_SSLv3));
|
299
304
|
#if HAVE_CURL_SSLVERSION_TLSV1_0
|
300
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_0",
|
305
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_0", LONG2NUM(CURL_SSLVERSION_TLSv1_0));
|
306
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_0", LONG2NUM(CURL_SSLVERSION_MAX_TLSv1_0));
|
301
307
|
#endif
|
302
308
|
#if HAVE_CURL_SSLVERSION_TLSV1_1
|
303
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_1",
|
309
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_1", LONG2NUM(CURL_SSLVERSION_TLSv1_1));
|
310
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_1", LONG2NUM(CURL_SSLVERSION_MAX_TLSv1_1));
|
304
311
|
#endif
|
305
312
|
#if HAVE_CURL_SSLVERSION_TLSV1_2
|
306
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_2",
|
313
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_2", LONG2NUM(CURL_SSLVERSION_TLSv1_2));
|
314
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_2", LONG2NUM(CURL_SSLVERSION_MAX_TLSv1_2));
|
315
|
+
#endif
|
316
|
+
#if HAVE_CURL_SSLVERSION_TLSV1_3
|
317
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_3", LONG2NUM(CURL_SSLVERSION_TLSv1_3));
|
318
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_3", LONG2NUM(CURL_SSLVERSION_MAX_TLSv1_3));
|
307
319
|
#endif
|
308
320
|
|
309
321
|
rb_define_const(mCurl, "CURL_USESSL_CONTROL", LONG2NUM(CURB_FTPSSL_CONTROL));
|
@@ -316,13 +328,20 @@ void Init_curb_core() {
|
|
316
328
|
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", LONG2NUM(-1));
|
317
329
|
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", LONG2NUM(-1));
|
318
330
|
#if HAVE_CURL_SSLVERSION_TLSv1_0
|
319
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_0",
|
331
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_0", LONG2NUM(-1));
|
332
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_0", LONG2NUM(-1));
|
320
333
|
#endif
|
321
334
|
#if HAVE_CURL_SSLVERSION_TLSv1_1
|
322
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_1",
|
335
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_1", LONG2NUM(-1));
|
336
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_1", LONG2NUM(-1));
|
323
337
|
#endif
|
324
338
|
#if HAVE_CURL_SSLVERSION_TLSv1_2
|
325
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_2",
|
339
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_2", LONG2NUM(-1));
|
340
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_2", LONG2NUM(-1));
|
341
|
+
#endif
|
342
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_3
|
343
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_3", LONG2NUM(-1));
|
344
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_MAX_TLSv1_3", LONG2NUM(-1));
|
326
345
|
#endif
|
327
346
|
|
328
347
|
rb_define_const(mCurl, "CURL_USESSL_CONTROL", LONG2NUM(-1));
|
@@ -352,6 +371,13 @@ void Init_curb_core() {
|
|
352
371
|
rb_define_const(mCurl, "CURLPROXY_SOCKS5", LONG2NUM(-2));
|
353
372
|
#endif
|
354
373
|
|
374
|
+
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS5 proxy (and that the proxy should resolve the hostname). (libcurl >= 7.17.2) */
|
375
|
+
#ifdef HAVE_CURLPROXY_SOCKS5_HOSTNAME
|
376
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS5_HOSTNAME", LONG2NUM(CURLPROXY_SOCKS5_HOSTNAME));
|
377
|
+
#else
|
378
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS5_HOSTNAME", LONG2NUM(-2));
|
379
|
+
#endif
|
380
|
+
|
355
381
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Basic authentication. */
|
356
382
|
#ifdef HAVE_CURLAUTH_BASIC
|
357
383
|
rb_define_const(mCurl, "CURLAUTH_BASIC", LONG2NUM(CURLAUTH_BASIC));
|
@@ -585,6 +611,9 @@ void Init_curb_core() {
|
|
585
611
|
CURB_DEFINE(CURLOPT_REFERER);
|
586
612
|
CURB_DEFINE(CURLOPT_USERAGENT);
|
587
613
|
CURB_DEFINE(CURLOPT_HTTPHEADER);
|
614
|
+
#if HAVE_CURLOPT_PROXYHEADER
|
615
|
+
CURB_DEFINE(CURLOPT_PROXYHEADER);
|
616
|
+
#endif
|
588
617
|
#if HAVE_CURLOPT_HTTP200ALIASES
|
589
618
|
CURB_DEFINE(CURLOPT_HTTP200ALIASES);
|
590
619
|
#endif
|
@@ -915,12 +944,19 @@ void Init_curb_core() {
|
|
915
944
|
#endif
|
916
945
|
#if HAVE_CURL_SSLVERSION_TLSv1_0
|
917
946
|
CURB_DEFINE(CURL_SSLVERSION_TLSv1_0);
|
947
|
+
CURB_DEFINE(CURL_SSLVERSION_MAX_TLSv1_0);
|
918
948
|
#endif
|
919
949
|
#if HAVE_CURL_SSLVERSION_TLSv1_1
|
920
950
|
CURB_DEFINE(CURL_SSLVERSION_TLSv1_1);
|
951
|
+
CURB_DEFINE(CURL_SSLVERSION_MAX_TLSv1_1);
|
921
952
|
#endif
|
922
953
|
#if HAVE_CURL_SSLVERSION_TLSv1_2
|
923
954
|
CURB_DEFINE(CURL_SSLVERSION_TLSv1_2);
|
955
|
+
CURB_DEFINE(CURL_SSLVERSION_MAX_TLSv1_2);
|
956
|
+
#endif
|
957
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_3
|
958
|
+
CURB_DEFINE(CURL_SSLVERSION_TLSv1_3);
|
959
|
+
CURB_DEFINE(CURL_SSLVERSION_MAX_TLSv1_3);
|
924
960
|
#endif
|
925
961
|
#if HAVE_CURLOPT_SSL_VERIFYPEER
|
926
962
|
CURB_DEFINE(CURLOPT_SSL_VERIFYPEER);
|
@@ -1030,6 +1066,132 @@ void Init_curb_core() {
|
|
1030
1066
|
CURB_DEFINE(CURLOPT_PIPEWAIT);
|
1031
1067
|
#endif
|
1032
1068
|
|
1069
|
+
#if HAVE_CURLOPT_TCP_KEEPALIVE
|
1070
|
+
CURB_DEFINE(CURLOPT_TCP_KEEPALIVE);
|
1071
|
+
CURB_DEFINE(CURLOPT_TCP_KEEPIDLE);
|
1072
|
+
CURB_DEFINE(CURLOPT_TCP_KEEPINTVL);
|
1073
|
+
#endif
|
1074
|
+
|
1075
|
+
#if HAVE_CURLOPT_HAPROXYPROTOCOL
|
1076
|
+
CURB_DEFINE(CURLOPT_HAPROXYPROTOCOL);
|
1077
|
+
#endif
|
1078
|
+
|
1079
|
+
#if HAVE_CURLPROTO_RTMPTE
|
1080
|
+
CURB_DEFINE(CURLPROTO_RTMPTE);
|
1081
|
+
#endif
|
1082
|
+
|
1083
|
+
#if HAVE_CURLPROTO_RTMPTS
|
1084
|
+
CURB_DEFINE(CURLPROTO_RTMPTS);
|
1085
|
+
#endif
|
1086
|
+
|
1087
|
+
#if HAVE_CURLPROTO_SMBS
|
1088
|
+
CURB_DEFINE(CURLPROTO_SMBS);
|
1089
|
+
#endif
|
1090
|
+
|
1091
|
+
#if HAVE_CURLPROTO_LDAP
|
1092
|
+
CURB_DEFINE(CURLPROTO_LDAP);
|
1093
|
+
#endif
|
1094
|
+
|
1095
|
+
#if HAVE_CURLPROTO_FTP
|
1096
|
+
CURB_DEFINE(CURLPROTO_FTP);
|
1097
|
+
#endif
|
1098
|
+
|
1099
|
+
#if HAVE_CURLPROTO_SMTPS
|
1100
|
+
CURB_DEFINE(CURLPROTO_SMTPS);
|
1101
|
+
#endif
|
1102
|
+
|
1103
|
+
#if HAVE_CURLPROTO_HTTP
|
1104
|
+
CURB_DEFINE(CURLPROTO_HTTP);
|
1105
|
+
#endif
|
1106
|
+
|
1107
|
+
#if HAVE_CURLPROTO_SMTP
|
1108
|
+
CURB_DEFINE(CURLPROTO_SMTP);
|
1109
|
+
#endif
|
1110
|
+
|
1111
|
+
#if HAVE_CURLPROTO_TFTP
|
1112
|
+
CURB_DEFINE(CURLPROTO_TFTP);
|
1113
|
+
#endif
|
1114
|
+
|
1115
|
+
#if HAVE_CURLPROTO_LDAPS
|
1116
|
+
CURB_DEFINE(CURLPROTO_LDAPS);
|
1117
|
+
#endif
|
1118
|
+
|
1119
|
+
#if HAVE_CURLPROTO_IMAPS
|
1120
|
+
CURB_DEFINE(CURLPROTO_IMAPS);
|
1121
|
+
#endif
|
1122
|
+
|
1123
|
+
#if HAVE_CURLPROTO_SCP
|
1124
|
+
CURB_DEFINE(CURLPROTO_SCP);
|
1125
|
+
#endif
|
1126
|
+
|
1127
|
+
#if HAVE_CURLPROTO_SFTP
|
1128
|
+
CURB_DEFINE(CURLPROTO_SFTP);
|
1129
|
+
#endif
|
1130
|
+
|
1131
|
+
#if HAVE_CURLPROTO_TELNET
|
1132
|
+
CURB_DEFINE(CURLPROTO_TELNET);
|
1133
|
+
#endif
|
1134
|
+
|
1135
|
+
#if HAVE_CURLPROTO_FILE
|
1136
|
+
CURB_DEFINE(CURLPROTO_FILE);
|
1137
|
+
#endif
|
1138
|
+
|
1139
|
+
#if HAVE_CURLPROTO_FTPS
|
1140
|
+
CURB_DEFINE(CURLPROTO_FTPS);
|
1141
|
+
#endif
|
1142
|
+
|
1143
|
+
#if HAVE_CURLPROTO_HTTPS
|
1144
|
+
CURB_DEFINE(CURLPROTO_HTTPS);
|
1145
|
+
#endif
|
1146
|
+
|
1147
|
+
#if HAVE_CURLPROTO_IMAP
|
1148
|
+
CURB_DEFINE(CURLPROTO_IMAP);
|
1149
|
+
#endif
|
1150
|
+
|
1151
|
+
#if HAVE_CURLPROTO_POP3
|
1152
|
+
CURB_DEFINE(CURLPROTO_POP3);
|
1153
|
+
#endif
|
1154
|
+
|
1155
|
+
#if HAVE_CURLPROTO_GOPHER
|
1156
|
+
CURB_DEFINE(CURLPROTO_GOPHER);
|
1157
|
+
#endif
|
1158
|
+
|
1159
|
+
#if HAVE_CURLPROTO_DICT
|
1160
|
+
CURB_DEFINE(CURLPROTO_DICT);
|
1161
|
+
#endif
|
1162
|
+
|
1163
|
+
#if HAVE_CURLPROTO_SMB
|
1164
|
+
CURB_DEFINE(CURLPROTO_SMB);
|
1165
|
+
#endif
|
1166
|
+
|
1167
|
+
#if HAVE_CURLPROTO_RTMP
|
1168
|
+
CURB_DEFINE(CURLPROTO_RTMP);
|
1169
|
+
#endif
|
1170
|
+
|
1171
|
+
#if HAVE_CURLPROTO_ALL
|
1172
|
+
CURB_DEFINE(CURLPROTO_ALL);
|
1173
|
+
#endif
|
1174
|
+
|
1175
|
+
#if HAVE_CURLPROTO_RTMPE
|
1176
|
+
CURB_DEFINE(CURLPROTO_RTMPE);
|
1177
|
+
#endif
|
1178
|
+
|
1179
|
+
#if HAVE_CURLPROTO_RTMPS
|
1180
|
+
CURB_DEFINE(CURLPROTO_RTMPS);
|
1181
|
+
#endif
|
1182
|
+
|
1183
|
+
#if HAVE_CURLPROTO_RTMPT
|
1184
|
+
CURB_DEFINE(CURLPROTO_RTMPT);
|
1185
|
+
#endif
|
1186
|
+
|
1187
|
+
#if HAVE_CURLPROTO_POP3S
|
1188
|
+
CURB_DEFINE(CURLPROTO_POP3S);
|
1189
|
+
#endif
|
1190
|
+
|
1191
|
+
#if HAVE_CURLPROTO_RTSP
|
1192
|
+
CURB_DEFINE(CURLPROTO_RTSP);
|
1193
|
+
#endif
|
1194
|
+
|
1033
1195
|
#if LIBCURL_VERSION_NUM >= 0x072B00 /* 7.43.0 */
|
1034
1196
|
CURB_DEFINE(CURLPIPE_NOTHING);
|
1035
1197
|
CURB_DEFINE(CURLPIPE_HTTP1);
|
data/ext/curb.h
CHANGED
@@ -9,8 +9,16 @@
|
|
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
|
|
21
|
+
#include "banned.h"
|
14
22
|
#include "curb_config.h"
|
15
23
|
#include "curb_easy.h"
|
16
24
|
#include "curb_errors.h"
|
@@ -20,11 +28,11 @@
|
|
20
28
|
#include "curb_macros.h"
|
21
29
|
|
22
30
|
// These should be managed from the Rake 'release' task.
|
23
|
-
#define CURB_VERSION "0.
|
24
|
-
#define CURB_VER_NUM
|
25
|
-
#define CURB_VER_MAJ
|
26
|
-
#define CURB_VER_MIN
|
27
|
-
#define CURB_VER_MIC
|
31
|
+
#define CURB_VERSION "1.0.1"
|
32
|
+
#define CURB_VER_NUM 1001
|
33
|
+
#define CURB_VER_MAJ 1
|
34
|
+
#define CURB_VER_MIN 0
|
35
|
+
#define CURB_VER_MIC 1
|
28
36
|
#define CURB_VER_PATCH 0
|
29
37
|
|
30
38
|
|
@@ -41,6 +49,11 @@
|
|
41
49
|
#define RHASH_SIZE(hash) RHASH(hash)->tbl->num_entries
|
42
50
|
#endif
|
43
51
|
|
52
|
+
// ruby 1.8 does not provide the macro
|
53
|
+
#ifndef DBL2NUM
|
54
|
+
#define DBL2NUM(dbl) rb_float_new(dbl)
|
55
|
+
#endif
|
56
|
+
|
44
57
|
extern VALUE mCurl;
|
45
58
|
|
46
59
|
extern void Init_curb_core();
|