- reimplement major parts of the request api
[m6w6/ext-http] / php_http_request_api.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-2005, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id$ */
14
15 #ifndef PHP_HTTP_REQUEST_API_H
16 #define PHP_HTTP_REQUEST_API_H
17
18 #ifdef HTTP_HAVE_CURL
19
20 #include "php_http_request_body_api.h"
21 #include "php_http_request_method_api.h"
22
23 extern PHP_MINIT_FUNCTION(http_request);
24 extern PHP_MSHUTDOWN_FUNCTION(http_request);
25
26 typedef struct {
27 CURL *ch;
28 char *url;
29 http_request_method meth;
30 http_request_body *body;
31
32 struct {
33 curl_infotype last_type;
34 phpstr request;
35 phpstr response;
36 } conv;
37
38 HashTable info;
39
40 struct {
41 phpstr cookies;
42 HashTable options;
43 struct curl_slist *headers;
44 } _cache;
45
46 #ifdef ZTS
47 void ***tsrm_ls;
48 #endif
49
50 } http_request;
51
52 #define http_request_init(r) _http_request_init_ex((r), NULL, 0, NULL TSRMLS_CC)
53 #define http_request_init_ex(r, c, m, u) _http_request_init_ex((r), (c), (m), (u) TSRMLS_CC)
54 PHP_HTTP_API http_request *_http_request_init_ex(http_request *request, CURL *ch, http_request_method meth, const char *url TSRMLS_DC);
55
56 #define http_request_dtor(r) _http_request_dtor((r))
57 PHP_HTTP_API void _http_request_dtor(http_request *request);
58
59 #define http_request_free(r) _http_request_free((r))
60 PHP_HTTP_API void _http_request_free(http_request **request);
61
62 #define http_request_reset(r) _http_request_reset(r)
63 PHP_HTTP_API void _http_request_reset(http_request *r);
64
65 #define http_request_prepare(r, o) _http_request_prepare((r), (o))
66 PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *options);
67
68 #define http_request_exec(r) _http_request_exec((r))
69 PHP_HTTP_API void _http_request_exec(http_request *request);
70
71 #define http_request_info(r, i) _http_request_info((r), (i))
72 PHP_HTTP_API void _http_request_info(r, i);
73
74 #endif
75 #endif
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 */
85