curb 1.3.7 → 1.4.1

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.
data/ext/curb_easy.h CHANGED
@@ -93,6 +93,8 @@ typedef struct {
93
93
  char unrestricted_auth;
94
94
  char verbose;
95
95
  char multipart_form_post;
96
+ char multipart_building; /* Disallow reentry while Ruby builds the form. */
97
+ char multipart_form_active; /* Temporary CURLOPT_HTTPPOST owned by perform. */
96
98
  char enable_cookies;
97
99
  char cookielist_engine_enabled; /* track if CURLOPT_COOKIELIST was used with a non-command to enable engine */
98
100
  char ignore_content_length;
@@ -112,6 +114,7 @@ typedef struct {
112
114
  curb_cidr_rule *network_allowed_cidr_rules;
113
115
  char **network_allowed_hosts;
114
116
 
117
+ /* attachment_sequence of the multi at the time this easy was last added. */
115
118
  unsigned long multi_attachment_generation;
116
119
  curl_off_t downloaded_body_bytes;
117
120
  size_t network_allowed_cidr_rule_count;
@@ -123,6 +126,9 @@ typedef struct {
123
126
  extern VALUE cCurlEasy;
124
127
  extern const rb_data_type_t ruby_curl_easy_data_type;
125
128
 
129
+ ruby_curl_easy *ruby_curl_easy_get_handle(VALUE self);
130
+ void ruby_curl_easy_check_access(ruby_curl_easy *rbce);
131
+
126
132
  VALUE ruby_curl_easy_setup(ruby_curl_easy *rbce);
127
133
  VALUE ruby_curl_easy_cleanup(VALUE self, ruby_curl_easy *rbce);
128
134
  VALUE rb_curl_easy_take_callback_error(ruby_curl_easy *rbce);
data/ext/curb_macros.h CHANGED
@@ -20,12 +20,17 @@
20
20
  #define rb_easy_get_str(key) \
21
21
  RSTRING_PTR((rb_easy_type_check(key,T_STRING) ? rb_easy_get(key) : rb_str_to_str(rb_easy_get(key))))
22
22
 
23
+ /* Easy attribute macros also participate in the native access guard. */
24
+ #define CURB_CHECK_ACCESS_ruby_curl_easy(ptr) ruby_curl_easy_check_access(ptr)
25
+ #define CURB_CHECK_ACCESS_ruby_curl_postfield(ptr) ((void)0)
26
+
23
27
  /* getter/setter macros for various things */
24
28
  /* setter for anything that stores a ruby VALUE in the struct */
25
29
  #define CURB_OBJECT_SETTER(type, attr) \
26
30
  type *ptr; \
27
31
  \
28
32
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
33
+ CURB_CHECK_ACCESS_##type(ptr); \
29
34
  ptr->attr = attr; \
30
35
  \
31
36
  return attr;
@@ -35,6 +40,7 @@
35
40
  type *ptr; \
36
41
  \
37
42
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
43
+ CURB_CHECK_ACCESS_##type(ptr); \
38
44
  return ptr->attr;
39
45
 
40
46
  /* setter for anything that stores a ruby VALUE in the struct opts hash */
@@ -42,6 +48,7 @@
42
48
  type *ptr; \
43
49
  \
44
50
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
51
+ CURB_CHECK_ACCESS_##type(ptr); \
45
52
  rb_hash_aset(ptr->opts, rb_easy_hkey(#attr), attr); \
46
53
  \
47
54
  return attr;
@@ -51,12 +58,14 @@
51
58
  type *ptr; \
52
59
  \
53
60
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
61
+ CURB_CHECK_ACCESS_##type(ptr); \
54
62
  return rb_hash_aref(ptr->opts, rb_easy_hkey(#attr));
55
63
 
56
64
  /* setter for bool flags */
57
65
  #define CURB_BOOLEAN_SETTER(type, attr) \
58
66
  type *ptr; \
59
67
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
68
+ CURB_CHECK_ACCESS_##type(ptr); \
60
69
  \
61
70
  if (attr == Qnil || attr == Qfalse) { \
62
71
  ptr->attr = 0; \
@@ -70,6 +79,7 @@
70
79
  #define CURB_BOOLEAN_GETTER(type, attr) \
71
80
  type *ptr; \
72
81
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
82
+ CURB_CHECK_ACCESS_##type(ptr); \
73
83
  \
74
84
  return((ptr->attr) ? Qtrue : Qfalse);
75
85
 
@@ -79,6 +89,7 @@
79
89
  VALUE oldproc; \
80
90
  \
81
91
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
92
+ CURB_CHECK_ACCESS_##type(ptr); \
82
93
  \
83
94
  oldproc = ptr->handler; \
84
95
  rb_scan_args(argc, argv, "0&", &ptr->handler); \
@@ -91,6 +102,7 @@
91
102
  VALUE oldproc, newproc; \
92
103
  \
93
104
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
105
+ CURB_CHECK_ACCESS_##type(ptr); \
94
106
  \
95
107
  oldproc = rb_hash_aref(ptr->opts, rb_easy_hkey(#handler)); \
96
108
  rb_scan_args(argc, argv, "0&", &newproc); \
@@ -104,6 +116,7 @@
104
116
  type *ptr; \
105
117
  \
106
118
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
119
+ CURB_CHECK_ACCESS_##type(ptr); \
107
120
  if (attr == Qnil) { \
108
121
  ptr->attr = nilval; \
109
122
  } else { \
@@ -117,6 +130,7 @@
117
130
  type *ptr; \
118
131
  \
119
132
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
133
+ CURB_CHECK_ACCESS_##type(ptr); \
120
134
  if (ptr->attr == nilval) { \
121
135
  return Qnil; \
122
136
  } else { \
@@ -128,6 +142,7 @@
128
142
  type *ptr; \
129
143
  \
130
144
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
145
+ CURB_CHECK_ACCESS_##type(ptr); \
131
146
  if (attr == Qnil) { \
132
147
  ptr->attr = 0; \
133
148
  } else { \
@@ -147,6 +162,7 @@
147
162
  type *ptr; \
148
163
  \
149
164
  TypedData_Get_Struct(self, type, &type##_data_type, ptr); \
165
+ CURB_CHECK_ACCESS_##type(ptr); \
150
166
  if (ptr->attr == 0) { \
151
167
  return Qnil; \
152
168
  } else { \