- solve that another way
[m6w6/ext-http] / php_http.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-2006, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id$ */
14
15 #ifndef PHP_EXT_HTTP_H
16 #define PHP_EXT_HTTP_H
17
18 #define PHP_EXT_HTTP_VERSION "0.23.0dev"
19
20 #ifdef HAVE_CONFIG_H
21 # include "config.h"
22 #else
23 # ifndef PHP_WIN32
24 # include "php_config.h"
25 # endif
26 #endif
27
28 #include "php.h"
29 #include "php_http_std_defs.h"
30 #include "phpstr/phpstr.h"
31 #include "missing.h"
32
33 #ifdef HTTP_WANT_SAPI
34 # if PHP_API_VERSION > 20041225
35 # define HTTP_HAVE_SAPI_RTIME
36 # define HTTP_GET_REQUEST_TIME() sapi_get_request_time(TSRMLS_C)
37 # else
38 # define HTTP_GET_REQUEST_TIME() HTTP_G(request_time)
39 # endif
40 # include "SAPI.h"
41 #endif
42
43 #ifdef HTTP_WANT_NETDB
44 # ifdef PHP_WIN32
45 # define HTTP_HAVE_NETDB
46 # include <winsock2.h>
47 # elif defined(HAVE_NETDB_H)
48 # define HTTP_HAVE_NETDB
49 # include <netdb.h>
50 # endif
51 #endif
52
53 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
54 # ifdef PHP_WIN32
55 # include <winsock2.h>
56 # define CURL_STATICLIB
57 # endif
58 # include <curl/curl.h>
59 #endif
60
61 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
62 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
63 # define USE_MAGIC_STATIC
64 # endif
65 # include <magic.h>
66 #endif
67
68 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
69 # include <zlib.h>
70 #endif
71
72 #include <ctype.h>
73
74 extern zend_module_entry http_module_entry;
75 #define phpext_http_ptr &http_module_entry
76
77 extern int http_module_number;
78
79 ZEND_BEGIN_MODULE_GLOBALS(http)
80
81 struct _http_globals_etag {
82 char *mode;
83 void *ctx;
84 zend_bool started;
85 } etag;
86
87 struct _http_globals_log {
88 char *cache;
89 char *redirect;
90 char *allowed_methods;
91 char *composite;
92 } log;
93
94 struct _http_globals_send {
95 double throttle_delay;
96 size_t buffer_size;
97 char *content_type;
98 char *unquoted_etag;
99 time_t last_modified;
100 struct _http_globals_send_deflate {
101 zend_bool start_auto;
102 long start_flags;
103 int encoding;
104 void *stream;
105 } deflate;
106 struct _http_globals_send_inflate {
107 zend_bool start_auto;
108 long start_flags;
109 void *stream;
110 } inflate;
111 } send;
112
113 struct _http_globals_request {
114 struct _http_globals_request_methods {
115 char *allowed;
116 struct _http_globals_request_methods_custom {
117 int count;
118 void *entries;
119 } custom;
120 } methods;
121 } request;
122
123 #ifndef HTTP_HAVE_SAPI_RTIME
124 time_t request_time;
125 #endif
126 #ifdef ZEND_ENGINE_2
127 zend_bool only_exceptions;
128 #endif
129
130 zend_bool force_exit;
131 zend_bool read_post_data;
132
133 ZEND_END_MODULE_GLOBALS(http)
134
135 ZEND_EXTERN_MODULE_GLOBALS(http);
136
137 #ifdef ZTS
138 # include "TSRM.h"
139 # define HTTP_G(v) TSRMG(http_globals_id, zend_http_globals *, v)
140 # define HTTP_GLOBALS ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
141 #else
142 # define HTTP_G(v) (http_globals.v)
143 # define HTTP_GLOBALS (&http_globals)
144 #endif
145 #define getGlobals(G) zend_http_globals *G = HTTP_GLOBALS
146
147 PHP_FUNCTION(http_test);
148 PHP_FUNCTION(http_date);
149 PHP_FUNCTION(http_build_url);
150 PHP_FUNCTION(http_build_str);
151 PHP_FUNCTION(http_negotiate_language);
152 PHP_FUNCTION(http_negotiate_charset);
153 PHP_FUNCTION(http_negotiate_content_type);
154 PHP_FUNCTION(http_redirect);
155 PHP_FUNCTION(http_throttle);
156 PHP_FUNCTION(http_send_status);
157 PHP_FUNCTION(http_send_last_modified);
158 PHP_FUNCTION(http_send_content_type);
159 PHP_FUNCTION(http_send_content_disposition);
160 PHP_FUNCTION(http_match_modified);
161 PHP_FUNCTION(http_match_etag);
162 PHP_FUNCTION(http_cache_last_modified);
163 PHP_FUNCTION(http_cache_etag);
164 PHP_FUNCTION(http_send_data);
165 PHP_FUNCTION(http_send_file);
166 PHP_FUNCTION(http_send_stream);
167 PHP_FUNCTION(http_chunked_decode);
168 PHP_FUNCTION(http_parse_message);
169 PHP_FUNCTION(http_parse_headers);
170 PHP_FUNCTION(http_parse_cookie);
171 PHP_FUNCTION(http_get_request_headers);
172 PHP_FUNCTION(http_get_request_body);
173 PHP_FUNCTION(http_get_request_body_stream);
174 PHP_FUNCTION(http_match_request_header);
175 #ifdef HTTP_HAVE_CURL
176 PHP_FUNCTION(http_get);
177 PHP_FUNCTION(http_head);
178 PHP_FUNCTION(http_post_data);
179 PHP_FUNCTION(http_post_fields);
180 PHP_FUNCTION(http_put_file);
181 PHP_FUNCTION(http_put_stream);
182 #endif /* HTTP_HAVE_CURL */
183 PHP_FUNCTION(http_request_method_register);
184 PHP_FUNCTION(http_request_method_unregister);
185 PHP_FUNCTION(http_request_method_exists);
186 PHP_FUNCTION(http_request_method_name);
187 PHP_FUNCTION(ob_etaghandler);
188 #ifdef HTTP_HAVE_ZLIB
189 PHP_FUNCTION(http_deflate);
190 PHP_FUNCTION(http_inflate);
191 PHP_FUNCTION(ob_deflatehandler);
192 PHP_FUNCTION(ob_inflatehandler);
193 #endif
194 PHP_FUNCTION(http_support);
195
196 PHP_MINIT_FUNCTION(http);
197 PHP_MSHUTDOWN_FUNCTION(http);
198 PHP_RINIT_FUNCTION(http);
199 PHP_RSHUTDOWN_FUNCTION(http);
200 PHP_MINFO_FUNCTION(http);
201
202 #endif /* PHP_HTTP_H */
203
204 /*
205 * Local variables:
206 * tab-width: 4
207 * c-basic-offset: 4
208 * End:
209 * vim600: noet sw=4 ts=4 fdm=marker
210 * vim<600: noet sw=4 ts=4
211 */
212