1b1f24b6ea3e5bcd5b32354b2f42f68a476b661f
[m6w6/ext-http] / php_http_client_curl.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_CLIENT_CURL_H
14 #define PHP_HTTP_CLIENT_CURL_H
15
16 #if PHP_HTTP_HAVE_CURL
17
18 PHP_HTTP_API php_http_client_ops_t *php_http_client_curl_get_ops(void);
19
20 typedef struct php_http_client_curl {
21 CURL *handle;
22
23 struct {
24 HashTable cache;
25
26 struct curl_slist *headers;
27 struct curl_slist *resolve;
28 php_http_buffer_t cookies;
29
30 long redirects;
31
32 struct {
33 uint count;
34 double delay;
35 } retry;
36
37 } options;
38
39 php_http_client_progress_t progress;
40
41 } php_http_client_curl_t;
42
43 typedef struct php_http_client_curl_storage {
44 char *url;
45 char *cookiestore;
46 char errorbuffer[0x100];
47 } php_http_client_curl_storage_t;
48
49 static inline php_http_client_curl_storage_t *get_storage(CURL *ch) {
50 php_http_client_curl_storage_t *st = NULL;
51
52 curl_easy_getinfo(ch, CURLINFO_PRIVATE, &st);
53
54 if (!st) {
55 st = pecalloc(1, sizeof(*st), 1);
56 curl_easy_setopt(ch, CURLOPT_PRIVATE, st);
57 curl_easy_setopt(ch, CURLOPT_ERRORBUFFER, st->errorbuffer);
58 }
59
60 return st;
61 }
62
63 extern STATUS php_http_client_curl_prepare(php_http_client_t *h, php_http_message_t *msg);
64
65 extern zend_class_entry *php_http_client_curl_class_entry;
66 extern zend_function_entry php_http_client_curl_method_entry[];
67
68 extern zend_object_value php_http_client_curl_object_new(zend_class_entry *ce TSRMLS_DC);
69 extern zend_object_value php_http_client_curl_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC);
70
71 PHP_MINIT_FUNCTION(http_client_curl);
72
73 #endif /* PHP_HTTP_HAVE_CURL */
74 #endif /* PHP_HTTP_CLIENT_CURL_H */
75
76
77 /*
78 * Local variables:
79 * tab-width: 4
80 * c-basic-offset: 4
81 * End:
82 * vim600: noet sw=4 ts=4 fdm=marker
83 * vim<600: noet sw=4 ts=4
84 */