use the params parser for query strings
[m6w6/ext-http] / php_http_curl_client.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_CURL_CLIENT_H
14 #define PHP_HTTP_CURL_CLIENT_H
15
16 #if PHP_HTTP_HAVE_CURL
17
18 PHP_HTTP_API php_http_client_ops_t *php_http_curl_client_get_ops(void);
19
20 typedef struct php_http_curl_client {
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 php_http_buffer_t ranges;
30
31 long redirects;
32 unsigned range_request:1;
33 unsigned encode_cookies:1;
34
35 struct {
36 uint count;
37 double delay;
38 } retry;
39
40 } options;
41
42 php_http_client_progress_t progress;
43
44 } php_http_curl_client_t;
45
46 typedef struct php_http_curl_client_storage {
47 char *url;
48 char *cookiestore;
49 char errorbuffer[0x100];
50 } php_http_curl_client_storage_t;
51
52 static inline php_http_curl_client_storage_t *php_http_curl_client_get_storage(CURL *ch) {
53 php_http_curl_client_storage_t *st = NULL;
54
55 curl_easy_getinfo(ch, CURLINFO_PRIVATE, &st);
56
57 if (!st) {
58 st = pecalloc(1, sizeof(*st), 1);
59 curl_easy_setopt(ch, CURLOPT_PRIVATE, st);
60 curl_easy_setopt(ch, CURLOPT_ERRORBUFFER, st->errorbuffer);
61 }
62
63 return st;
64 }
65
66 PHP_HTTP_API STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_message_t *msg);
67
68 zend_class_entry *php_http_curl_client_get_class_entry(void);
69
70 zend_object_value php_http_curl_client_object_new(zend_class_entry *ce TSRMLS_DC);
71 zend_object_value php_http_curl_client_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC);
72
73 PHP_MINIT_FUNCTION(http_curl_client);
74 PHP_MSHUTDOWN_FUNCTION(http_curl_client);
75
76 #endif /* PHP_HTTP_HAVE_CURL */
77 #endif /* PHP_HTTP_CURL_CLIENT_H */
78
79
80 /*
81 * Local variables:
82 * tab-width: 4
83 * c-basic-offset: 4
84 * End:
85 * vim600: noet sw=4 ts=4 fdm=marker
86 * vim<600: noet sw=4 ts=4
87 */