fff7bdc469db9bdea4df80bfc984575bd63f60a1
[m6w6/ext-http] / php_http.h
1 /*
2 +----------------------------------------------------------------------+
3 | PECL :: http |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.0 of the PHP license, that |
6 | is bundled with this package in the file LICENSE, and is available |
7 | through the world-wide-web at http://www.php.net/license/3_0.txt. |
8 | If you did not receive a copy of the PHP license and are unable to |
9 | obtain it through the world-wide-web, please send a note to |
10 | license@php.net so we can mail you a copy immediately. |
11 +----------------------------------------------------------------------+
12 | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
13 +----------------------------------------------------------------------+
14 */
15
16 /* $Id$ */
17
18 #ifndef PHP_EXT_HTTP_H
19 #define PHP_EXT_HTTP_H
20
21 #define HTTP_PEXT_VERSION "0.11.0"
22
23 /* make compile on Win32 */
24 #ifdef HTTP_HAVE_CURL
25 # ifdef PHP_WIN32
26 # include <winsock2.h>
27 # endif
28 # include <curl/curl.h>
29 #endif
30 #include "ext/standard/md5.h"
31 #include "phpstr/phpstr.h"
32
33 extern zend_module_entry http_module_entry;
34 #define phpext_http_ptr &http_module_entry
35
36 extern int http_module_number;
37
38 ZEND_BEGIN_MODULE_GLOBALS(http)
39
40 #ifdef ZEND_ENGINE_2
41 zend_bool only_exceptions;
42 #endif
43 struct _http_globals_etag {
44 zend_bool started;
45 PHP_MD5_CTX md5ctx;
46 } etag;
47
48 struct _http_globals_log {
49 char *cache;
50 } log;
51
52 struct _http_globals_send {
53 double throttle_delay;
54 size_t buffer_size;
55 char *content_type;
56 char *unquoted_etag;
57 time_t last_modified;
58 } send;
59
60 struct _http_globals_request {
61 struct _http_globals_request_methods {
62 char *allowed;
63 HashTable custom;
64 } methods;
65
66 #ifdef HTTP_HAVE_CURL
67 struct _http_globlas_request_copies {
68 zend_llist strings;
69 zend_llist slists;
70 zend_llist contexts;
71 zend_llist convs;
72 } copies;
73 # if LIBCURL_VERSION_NUM < 0x070c00
74 char error[CURL_ERROR_SIZE + 1];
75 # endif
76 #endif /* HTTP_HAVE_CURL */
77 } request;
78
79 ZEND_END_MODULE_GLOBALS(http)
80
81 #ifdef ZTS
82 # include "TSRM.h"
83 # define HTTP_G(v) TSRMG(http_globals_id, zend_http_globals *, v)
84 # define HTTP_GLOBALS ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
85 #else
86 # define HTTP_G(v) (http_globals.v)
87 # define HTTP_GLOBALS (&http_globals)
88 #endif
89 #define getGlobals(G) zend_http_globals *G = HTTP_GLOBALS;
90
91 PHP_FUNCTION(http_test);
92 PHP_FUNCTION(http_date);
93 PHP_FUNCTION(http_absolute_uri);
94 PHP_FUNCTION(http_negotiate_language);
95 PHP_FUNCTION(http_negotiate_charset);
96 PHP_FUNCTION(http_redirect);
97 PHP_FUNCTION(http_throttle);
98 PHP_FUNCTION(http_send_status);
99 PHP_FUNCTION(http_send_last_modified);
100 PHP_FUNCTION(http_send_content_type);
101 PHP_FUNCTION(http_send_content_disposition);
102 PHP_FUNCTION(http_match_modified);
103 PHP_FUNCTION(http_match_etag);
104 PHP_FUNCTION(http_cache_last_modified);
105 PHP_FUNCTION(http_cache_etag);
106 PHP_FUNCTION(http_send_data);
107 PHP_FUNCTION(http_send_file);
108 PHP_FUNCTION(http_send_stream);
109 PHP_FUNCTION(http_chunked_decode);
110 PHP_FUNCTION(http_split_response);
111 PHP_FUNCTION(http_parse_headers);
112 PHP_FUNCTION(http_get_request_headers);
113 PHP_FUNCTION(http_get_request_body);
114 PHP_FUNCTION(http_match_request_header);
115 #ifdef HTTP_HAVE_CURL
116 PHP_FUNCTION(http_get);
117 PHP_FUNCTION(http_head);
118 PHP_FUNCTION(http_post_data);
119 PHP_FUNCTION(http_post_fields);
120 PHP_FUNCTION(http_put_file);
121 PHP_FUNCTION(http_put_stream);
122 /*PHP_FUNCTION(http_request)*/
123 PHP_FUNCTION(http_request_method_register);
124 PHP_FUNCTION(http_request_method_unregister);
125 PHP_FUNCTION(http_request_method_exists);
126 PHP_FUNCTION(http_request_method_name);
127 #endif /* HTTP_HAVE_CURL */
128 PHP_FUNCTION(http_auth_basic);
129 PHP_FUNCTION(http_auth_basic_cb);
130 #ifndef ZEND_ENGINE_2
131 PHP_FUNCTION(http_build_query);
132 #endif /* ZEND_ENGINE_2 */
133 PHP_FUNCTION(ob_etaghandler);
134
135 PHP_MINIT_FUNCTION(http);
136 PHP_MSHUTDOWN_FUNCTION(http);
137 PHP_RINIT_FUNCTION(http);
138 PHP_RSHUTDOWN_FUNCTION(http);
139 PHP_MINFO_FUNCTION(http);
140
141 #endif /* PHP_HTTP_H */
142
143 /*
144 * Local variables:
145 * tab-width: 4
146 * c-basic-offset: 4
147 * End:
148 * vim600: noet sw=4 ts=4 fdm=marker
149 * vim<600: noet sw=4 ts=4
150 */
151