curb 1.3.4 → 1.3.6
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.md +57 -0
- data/Rakefile +24 -2
- data/doc.rb +48 -8
- data/ext/curb.c +24 -0
- data/ext/curb.h +3 -3
- data/ext/curb_easy.c +1378 -55
- data/ext/curb_easy.h +26 -0
- data/ext/curb_errors.c +2 -0
- data/ext/curb_errors.h +1 -0
- data/ext/curb_multi.c +330 -74
- data/ext/curb_multi.h +1 -0
- data/ext/extconf.rb +9 -0
- data/lib/curl/download.rb +160 -0
- data/lib/curl/easy.rb +113 -13
- data/lib/curl/multi.rb +172 -39
- data/lib/curl.rb +471 -11
- data/tests/bug_poison.rb +29 -0
- data/tests/tc_curl_download.rb +86 -0
- data/tests/tc_curl_easy.rb +76 -0
- data/tests/tc_curl_maxfilesize.rb +201 -1
- data/tests/tc_curl_multi.rb +293 -0
- data/tests/tc_curl_network_policy.rb +1475 -0
- data/tests/tc_curl_protocols.rb +351 -0
- data/tests/tc_fiber_scheduler.rb +64 -5
- metadata +8 -3
data/ext/curb_easy.h
CHANGED
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
|
|
12
12
|
#include <curl/easy.h>
|
|
13
13
|
|
|
14
|
+
#define CURB_NETWORK_POLICY_NONE 0
|
|
15
|
+
#define CURB_NETWORK_POLICY_PUBLIC 1
|
|
16
|
+
|
|
17
|
+
#define CURB_CIDR_FAMILY_IPV4 4
|
|
18
|
+
#define CURB_CIDR_FAMILY_IPV6 6
|
|
19
|
+
|
|
20
|
+
typedef struct {
|
|
21
|
+
unsigned char family;
|
|
22
|
+
unsigned char prefix_bits;
|
|
23
|
+
unsigned char address[16];
|
|
24
|
+
} curb_cidr_rule;
|
|
25
|
+
|
|
14
26
|
#ifdef CURL_VERSION_SSL
|
|
15
27
|
#if LIBCURL_VERSION_NUM >= 0x070b00
|
|
16
28
|
# if LIBCURL_VERSION_NUM <= 0x071004
|
|
@@ -38,6 +50,7 @@ typedef struct {
|
|
|
38
50
|
|
|
39
51
|
/* Buffer for error details from CURLOPT_ERRORBUFFER */
|
|
40
52
|
char err_buf[CURL_ERROR_SIZE];
|
|
53
|
+
char unsafe_destination_error[CURL_ERROR_SIZE];
|
|
41
54
|
|
|
42
55
|
VALUE self; /* owning Ruby object */
|
|
43
56
|
VALUE opts; /* rather then allocate everything we might need to store, allocate a Hash and only store objects we actually use... */
|
|
@@ -67,6 +80,7 @@ typedef struct {
|
|
|
67
80
|
long ftp_filemethod;
|
|
68
81
|
long http_version;
|
|
69
82
|
unsigned short resolve_mode;
|
|
83
|
+
unsigned short network_policy;
|
|
70
84
|
|
|
71
85
|
/* bool flags */
|
|
72
86
|
char proxy_tunnel;
|
|
@@ -83,13 +97,25 @@ typedef struct {
|
|
|
83
97
|
char cookielist_engine_enabled; /* track if CURLOPT_COOKIELIST was used with a non-command to enable engine */
|
|
84
98
|
char ignore_content_length;
|
|
85
99
|
char callback_active;
|
|
100
|
+
char unsafe_destination_blocked;
|
|
101
|
+
char allow_proxy;
|
|
102
|
+
char allow_unix_socket;
|
|
103
|
+
char forbid_reuse_set;
|
|
104
|
+
unsigned int native_active;
|
|
105
|
+
long forbid_reuse;
|
|
86
106
|
|
|
87
107
|
struct curl_slist *curl_headers;
|
|
88
108
|
struct curl_slist *curl_proxy_headers;
|
|
89
109
|
struct curl_slist *curl_ftp_commands;
|
|
90
110
|
struct curl_slist *curl_resolve;
|
|
111
|
+
struct curl_slist *curl_connect_to;
|
|
112
|
+
curb_cidr_rule *network_allowed_cidr_rules;
|
|
113
|
+
char **network_allowed_hosts;
|
|
91
114
|
|
|
92
115
|
unsigned long multi_attachment_generation;
|
|
116
|
+
curl_off_t downloaded_body_bytes;
|
|
117
|
+
size_t network_allowed_cidr_rule_count;
|
|
118
|
+
size_t network_allowed_host_count;
|
|
93
119
|
int last_result; /* last result code from multi loop */
|
|
94
120
|
|
|
95
121
|
} ruby_curl_easy;
|
data/ext/curb_errors.c
CHANGED
|
@@ -110,6 +110,7 @@ VALUE eCurlErrSSLShutdownFailed;
|
|
|
110
110
|
VALUE eCurlErrAgain;
|
|
111
111
|
VALUE eCurlErrSSLCRLBadfile;
|
|
112
112
|
VALUE eCurlErrSSLIssuerError;
|
|
113
|
+
VALUE eCurlErrUnsafeDestination;
|
|
113
114
|
|
|
114
115
|
/* multi errors */
|
|
115
116
|
VALUE mCurlErrFailedInit;
|
|
@@ -699,6 +700,7 @@ void init_curb_errors() {
|
|
|
699
700
|
eCurlErrSSLCacertBadfile = rb_define_class_under(mCurlErr, "SSLCaertBadFile", eCurlErrError);
|
|
700
701
|
eCurlErrSSLCRLBadfile = rb_define_class_under(mCurlErr, "SSLCRLBadfile", eCurlErrError);
|
|
701
702
|
eCurlErrSSLIssuerError = rb_define_class_under(mCurlErr, "SSLIssuerError", eCurlErrError);
|
|
703
|
+
eCurlErrUnsafeDestination = rb_define_class_under(mCurlErr, "UnsafeDestinationError", eCurlErrError);
|
|
702
704
|
eCurlErrSSLShutdownFailed = rb_define_class_under(mCurlErr, "SSLShutdownFailed", eCurlErrError);
|
|
703
705
|
eCurlErrSSH = rb_define_class_under(mCurlErr, "SSH", eCurlErrError);
|
|
704
706
|
|
data/ext/curb_errors.h
CHANGED
|
@@ -106,6 +106,7 @@ extern VALUE eCurlErrSSLShutdownFailed;
|
|
|
106
106
|
extern VALUE eCurlErrAgain;
|
|
107
107
|
extern VALUE eCurlErrSSLCRLBadfile;
|
|
108
108
|
extern VALUE eCurlErrSSLIssuerError;
|
|
109
|
+
extern VALUE eCurlErrUnsafeDestination;
|
|
109
110
|
|
|
110
111
|
/* multi errors */
|
|
111
112
|
extern VALUE mCurlErrFailedInit;
|