ghazel-curb 0.5.9.0
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/LICENSE +51 -0
- data/README +157 -0
- data/Rakefile +297 -0
- data/doc.rb +42 -0
- data/ext/curb.c +339 -0
- data/ext/curb.h +50 -0
- data/ext/curb_easy.c +2932 -0
- data/ext/curb_easy.h +103 -0
- data/ext/curb_errors.c +630 -0
- data/ext/curb_errors.h +128 -0
- data/ext/curb_macros.h +114 -0
- data/ext/curb_multi.c +487 -0
- data/ext/curb_multi.h +26 -0
- data/ext/curb_postfield.c +511 -0
- data/ext/curb_postfield.h +40 -0
- data/ext/curb_upload.c +80 -0
- data/ext/curb_upload.h +30 -0
- data/ext/extconf.rb +162 -0
- data/lib/curb.rb +184 -0
- data/lib/curl.rb +2 -0
- data/tests/alltests.rb +3 -0
- data/tests/bug_curb_easy_blocks_ruby_threads.rb +52 -0
- data/tests/bug_instance_post_differs_from_class_post.rb +53 -0
- data/tests/bug_multi_segfault.rb +10 -0
- data/tests/bug_require_last_or_segfault.rb +40 -0
- data/tests/helper.rb +168 -0
- data/tests/require_last_or_segfault_script.rb +36 -0
- data/tests/tc_curl_download.rb +32 -0
- data/tests/tc_curl_easy.rb +664 -0
- data/tests/tc_curl_multi.rb +421 -0
- data/tests/tc_curl_postfield.rb +141 -0
- data/tests/unittests.rb +2 -0
- metadata +89 -0
data/ext/curb_easy.h
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
/* curb_easy.h - Curl easy mode
|
2
|
+
* Copyright (c)2006 Ross Bamford.
|
3
|
+
* Licensed under the Ruby License. See LICENSE for details.
|
4
|
+
*
|
5
|
+
* $Id: curb_easy.h 25 2006-12-07 23:38:25Z roscopeco $
|
6
|
+
*/
|
7
|
+
#ifndef __CURB_EASY_H
|
8
|
+
#define __CURB_EASY_H
|
9
|
+
|
10
|
+
#include "curb.h"
|
11
|
+
|
12
|
+
#include <curl/easy.h>
|
13
|
+
|
14
|
+
/* a lot of this *could* be kept in the handler itself,
|
15
|
+
* but then we lose the ability to query it's status.
|
16
|
+
*/
|
17
|
+
typedef struct {
|
18
|
+
/* The handler */
|
19
|
+
CURL *curl;
|
20
|
+
|
21
|
+
/* Objects we associate */
|
22
|
+
VALUE url;
|
23
|
+
VALUE proxy_url;
|
24
|
+
|
25
|
+
VALUE body_proc;
|
26
|
+
VALUE header_proc;
|
27
|
+
VALUE body_data; /* Holds the response body from the last call to curl_easy_perform */
|
28
|
+
VALUE header_data; /* unless a block is supplied (they'll be nil) */
|
29
|
+
VALUE progress_proc;
|
30
|
+
VALUE debug_proc;
|
31
|
+
VALUE interface_hm;
|
32
|
+
VALUE userpwd;
|
33
|
+
VALUE proxypwd;
|
34
|
+
VALUE headers; /* ruby array of strings with headers to set */
|
35
|
+
VALUE cookies; /* string */
|
36
|
+
VALUE cookiefile; /* filename */
|
37
|
+
VALUE cookiejar; /* filename */
|
38
|
+
VALUE cert;
|
39
|
+
VALUE cacert;
|
40
|
+
VALUE certpassword;
|
41
|
+
VALUE certtype;
|
42
|
+
VALUE encoding;
|
43
|
+
VALUE useragent;
|
44
|
+
|
45
|
+
VALUE success_proc;
|
46
|
+
VALUE failure_proc;
|
47
|
+
VALUE complete_proc;
|
48
|
+
|
49
|
+
/* Other opts */
|
50
|
+
unsigned short local_port; // 0 is no port
|
51
|
+
unsigned short local_port_range; // " " " "
|
52
|
+
unsigned short proxy_port; // " " " "
|
53
|
+
int proxy_type;
|
54
|
+
long http_auth_types;
|
55
|
+
long proxy_auth_types;
|
56
|
+
long max_redirs;
|
57
|
+
unsigned long timeout;
|
58
|
+
unsigned long connect_timeout;
|
59
|
+
long dns_cache_timeout;
|
60
|
+
unsigned long ftp_response_timeout;
|
61
|
+
|
62
|
+
/* bool flags */
|
63
|
+
char proxy_tunnel;
|
64
|
+
char fetch_file_time;
|
65
|
+
char ssl_verify_peer;
|
66
|
+
char ssl_verify_host;
|
67
|
+
char header_in_body;
|
68
|
+
char use_netrc;
|
69
|
+
char follow_location;
|
70
|
+
char unrestricted_auth;
|
71
|
+
char verbose;
|
72
|
+
char multipart_form_post;
|
73
|
+
char enable_cookies;
|
74
|
+
|
75
|
+
/* this is sometimes used as a buffer for a form data string,
|
76
|
+
* which we alloc in C and need to hang around for the call,
|
77
|
+
* and in case it's asked for before the next call.
|
78
|
+
*/
|
79
|
+
VALUE postdata_buffer;
|
80
|
+
|
81
|
+
/* when added to a multi handle these buffers are needed
|
82
|
+
* when the easy handle isn't supplied the body proc
|
83
|
+
* or a custom http header is passed.
|
84
|
+
*/
|
85
|
+
VALUE bodybuf;
|
86
|
+
VALUE headerbuf;
|
87
|
+
struct curl_slist *curl_headers;
|
88
|
+
|
89
|
+
VALUE self; /* pointer to self, used by multi interface */
|
90
|
+
VALUE upload; /* pointer to an active upload otherwise Qnil */
|
91
|
+
|
92
|
+
int last_result; /* last result code from multi loop */
|
93
|
+
|
94
|
+
} ruby_curl_easy;
|
95
|
+
|
96
|
+
extern VALUE cCurlEasy;
|
97
|
+
|
98
|
+
VALUE ruby_curl_easy_setup(ruby_curl_easy *rbce, VALUE *bodybuf, VALUE *headerbuf, struct curl_slist **headers);
|
99
|
+
VALUE ruby_curl_easy_cleanup(VALUE self, ruby_curl_easy *rbce, VALUE bodybuf, VALUE headerbuf, struct curl_slist *headers);
|
100
|
+
|
101
|
+
void init_curb_easy();
|
102
|
+
|
103
|
+
#endif
|