ghazel-curb 0.5.9.0

Sign up to get free protection for your applications and to get access to all the features.
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