- config.m4 moved to config9.m4
[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 "1.0.0-dev"
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 # else
37 # endif
38 # include "SAPI.h"
39 #endif
40
41 #ifdef HTTP_WANT_NETDB
42 # ifdef PHP_WIN32
43 # define HTTP_HAVE_NETDB
44 # include <winsock2.h>
45 # elif defined(HAVE_NETDB_H)
46 # define HTTP_HAVE_NETDB
47 # include <netdb.h>
48 # ifdef HAVE_UNISTD_H
49 # include <unistd.h>
50 # endif
51 # endif
52 #endif
53
54 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
55 # ifdef PHP_WIN32
56 # include <winsock2.h>
57 # define CURL_STATICLIB
58 # endif
59 # include <curl/curl.h>
60 # define HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z)))
61 #endif
62
63 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
64 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
65 # define USE_MAGIC_STATIC
66 # endif
67 # include <magic.h>
68 #endif
69
70 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
71 # include <zlib.h>
72 #endif
73
74 #include <ctype.h>
75
76 extern zend_module_entry http_module_entry;
77 #define phpext_http_ptr &http_module_entry
78
79 extern int http_module_number;
80
81 ZEND_BEGIN_MODULE_GLOBALS(http)
82
83 struct _http_globals_etag {
84 char *mode;
85 void *ctx;
86 zend_bool started;
87 } etag;
88
89 struct _http_globals_log {
90 char *cache;
91 char *redirect;
92 char *not_found;
93 char *allowed_methods;
94 char *composite;
95 } log;
96
97 struct _http_globals_send {
98 double throttle_delay;
99 size_t buffer_size;
100 char *content_type;
101 char *unquoted_etag;
102 time_t last_modified;
103 struct _http_globals_send_deflate {
104 zend_bool start_auto;
105 long start_flags;
106 int encoding;
107 void *stream;
108 } deflate;
109 struct _http_globals_send_inflate {
110 zend_bool start_auto;
111 long start_flags;
112 void *stream;
113 } inflate;
114 zend_bool not_found_404;
115 } send;
116
117 struct _http_globals_request {
118 time_t time;
119 struct _http_globals_request_methods {
120 char *allowed;
121 struct _http_globals_request_methods_custom {
122 char *ini;
123 int count;
124 void *entries;
125 } custom;
126 } methods;
127 } request;
128
129 #ifdef ZEND_ENGINE_2
130 zend_bool only_exceptions;
131 #endif
132
133 zend_bool force_exit;
134 zend_bool read_post_data;
135
136 ZEND_END_MODULE_GLOBALS(http)
137
138 ZEND_EXTERN_MODULE_GLOBALS(http);
139
140 #ifdef ZTS
141 # include "TSRM.h"
142 # define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
143 #else
144 # define HTTP_G (&http_globals)
145 #endif
146
147 #define HTTP_HAVE_EXT(EXT) ((defined(HAVE_##EXT) || defined(HAVE_PHP_##EXT)) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_##EXT)))
148
149 PHP_FUNCTION(http_test);
150 PHP_FUNCTION(http_date);
151 PHP_FUNCTION(http_build_url);
152 PHP_FUNCTION(http_build_str);
153 PHP_FUNCTION(http_negotiate_language);
154 PHP_FUNCTION(http_negotiate_charset);
155 PHP_FUNCTION(http_negotiate_content_type);
156 PHP_FUNCTION(http_redirect);
157 PHP_FUNCTION(http_throttle);
158 PHP_FUNCTION(http_send_status);
159 PHP_FUNCTION(http_send_last_modified);
160 PHP_FUNCTION(http_send_content_type);
161 PHP_FUNCTION(http_send_content_disposition);
162 PHP_FUNCTION(http_match_modified);
163 PHP_FUNCTION(http_match_etag);
164 PHP_FUNCTION(http_cache_last_modified);
165 PHP_FUNCTION(http_cache_etag);
166 PHP_FUNCTION(http_send_data);
167 PHP_FUNCTION(http_send_file);
168 PHP_FUNCTION(http_send_stream);
169 PHP_FUNCTION(http_chunked_decode);
170 PHP_FUNCTION(http_parse_message);
171 PHP_FUNCTION(http_parse_headers);
172 PHP_FUNCTION(http_parse_cookie);
173 PHP_FUNCTION(http_parse_params);
174 PHP_FUNCTION(http_get_request_headers);
175 PHP_FUNCTION(http_get_request_body);
176 PHP_FUNCTION(http_get_request_body_stream);
177 PHP_FUNCTION(http_match_request_header);
178 #ifdef HTTP_HAVE_CURL
179 PHP_FUNCTION(http_get);
180 PHP_FUNCTION(http_head);
181 PHP_FUNCTION(http_post_data);
182 PHP_FUNCTION(http_post_fields);
183 PHP_FUNCTION(http_put_data);
184 PHP_FUNCTION(http_put_file);
185 PHP_FUNCTION(http_put_stream);
186 PHP_FUNCTION(http_request);
187 #ifdef HAVE_CURL_GETFORMDATA
188 PHP_FUNCTION(http_request_body_encode);
189 #endif /* HAVE_CURL_GETFORMDATA */
190 #endif /* HTTP_HAVE_CURL */
191 PHP_FUNCTION(http_request_method_register);
192 PHP_FUNCTION(http_request_method_unregister);
193 PHP_FUNCTION(http_request_method_exists);
194 PHP_FUNCTION(http_request_method_name);
195 PHP_FUNCTION(ob_etaghandler);
196 #ifdef HTTP_HAVE_ZLIB
197 PHP_FUNCTION(http_deflate);
198 PHP_FUNCTION(http_inflate);
199 PHP_FUNCTION(ob_deflatehandler);
200 PHP_FUNCTION(ob_inflatehandler);
201 #endif
202 PHP_FUNCTION(http_support);
203
204 #endif /* PHP_HTTP_H */
205
206 /*
207 * Local variables:
208 * tab-width: 4
209 * c-basic-offset: 4
210 * End:
211 * vim600: noet sw=4 ts=4 fdm=marker
212 * vim<600: noet sw=4 ts=4
213 */
214