2 +--------------------------------------------------------------------+
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-2007, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
15 #ifndef PHP_EXT_HTTP_H
16 #define PHP_EXT_HTTP_H
18 #define PHP_EXT_HTTP_VERSION "1.5.6"
24 # include "php_config.h"
30 #include "php_http_std_defs.h"
31 #include "phpstr/phpstr.h"
34 # if PHP_API_VERSION > 20041225
35 # define HTTP_HAVE_SAPI_RTIME
40 #ifdef HTTP_WANT_NETDB
42 # define HTTP_HAVE_NETDB
43 # include <winsock2.h>
44 # elif defined(HAVE_NETDB_H)
45 # define HTTP_HAVE_NETDB
53 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
55 # include <winsock2.h>
56 # define CURL_STATICLIB
58 # include <curl/curl.h>
59 # define HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z)))
62 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
63 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
64 # define USE_MAGIC_STATIC
69 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
74 #define HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c))
75 #define HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c))
77 extern zend_module_entry http_module_entry
;
78 #define phpext_http_ptr &http_module_entry
80 extern int http_module_number
;
82 ZEND_BEGIN_MODULE_GLOBALS(http
)
84 struct _http_globals_etag
{
90 struct _http_globals_log
{
94 char *allowed_methods
;
98 struct _http_globals_send
{
99 double throttle_delay
;
103 time_t last_modified
;
104 struct _http_globals_send_deflate
{
106 zend_bool start_auto
;
111 struct _http_globals_send_inflate
{
112 zend_bool start_auto
;
116 zend_bool not_found_404
;
119 struct _http_globals_request
{
122 struct _http_globals_request_methods
{
123 HashTable registered
;
127 #if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL)
128 struct _http_globals_request_datashare
{
138 struct _http_globals_persistent
{
139 struct _http_globals_persistent_handles
{
141 struct _http_globals_persistent_handles_ident
{
150 zend_bool only_exceptions
;
153 zend_bool force_exit
;
154 zend_bool read_post_data
;
157 ZEND_END_MODULE_GLOBALS(http
)
159 ZEND_EXTERN_MODULE_GLOBALS(http
);
163 # define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
165 # define HTTP_G (&http_globals)
168 #if defined(HAVE_ICONV) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
169 # define HTTP_HAVE_ICONV
172 #if defined(HAVE_PHP_SESSION) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_SESSION))
173 # define HTTP_HAVE_SESSION
176 #if defined(HAVE_HASH_EXT) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_HASH)) && defined(HTTP_HAVE_PHP_HASH_H)
177 # define HTTP_HAVE_HASH
180 #if defined(HAVE_SPL)
181 # define HTTP_HAVE_SPL
184 PHP_FUNCTION(http_date
);
185 PHP_FUNCTION(http_build_url
);
186 PHP_FUNCTION(http_build_str
);
187 PHP_FUNCTION(http_negotiate_language
);
188 PHP_FUNCTION(http_negotiate_charset
);
189 PHP_FUNCTION(http_negotiate_content_type
);
190 PHP_FUNCTION(http_redirect
);
191 PHP_FUNCTION(http_throttle
);
192 PHP_FUNCTION(http_send_status
);
193 PHP_FUNCTION(http_send_last_modified
);
194 PHP_FUNCTION(http_send_content_type
);
195 PHP_FUNCTION(http_send_content_disposition
);
196 PHP_FUNCTION(http_match_modified
);
197 PHP_FUNCTION(http_match_etag
);
198 PHP_FUNCTION(http_cache_last_modified
);
199 PHP_FUNCTION(http_cache_etag
);
200 PHP_FUNCTION(http_send_data
);
201 PHP_FUNCTION(http_send_file
);
202 PHP_FUNCTION(http_send_stream
);
203 PHP_FUNCTION(http_chunked_decode
);
204 PHP_FUNCTION(http_parse_message
);
205 PHP_FUNCTION(http_parse_headers
);
206 PHP_FUNCTION(http_parse_cookie
);
207 PHP_FUNCTION(http_build_cookie
);
208 PHP_FUNCTION(http_parse_params
);
209 PHP_FUNCTION(http_get_request_headers
);
210 PHP_FUNCTION(http_get_request_body
);
211 PHP_FUNCTION(http_get_request_body_stream
);
212 PHP_FUNCTION(http_match_request_header
);
213 PHP_FUNCTION(http_persistent_handles_count
);
214 PHP_FUNCTION(http_persistent_handles_clean
);
215 PHP_FUNCTION(http_persistent_handles_ident
);
216 #ifdef HTTP_HAVE_CURL
217 PHP_FUNCTION(http_get
);
218 PHP_FUNCTION(http_head
);
219 PHP_FUNCTION(http_post_data
);
220 PHP_FUNCTION(http_post_fields
);
221 PHP_FUNCTION(http_put_data
);
222 PHP_FUNCTION(http_put_file
);
223 PHP_FUNCTION(http_put_stream
);
224 PHP_FUNCTION(http_request
);
225 PHP_FUNCTION(http_request_body_encode
);
226 #endif /* HTTP_HAVE_CURL */
227 PHP_FUNCTION(http_request_method_register
);
228 PHP_FUNCTION(http_request_method_unregister
);
229 PHP_FUNCTION(http_request_method_exists
);
230 PHP_FUNCTION(http_request_method_name
);
231 PHP_FUNCTION(ob_etaghandler
);
232 #ifdef HTTP_HAVE_ZLIB
233 PHP_FUNCTION(http_deflate
);
234 PHP_FUNCTION(http_inflate
);
235 PHP_FUNCTION(ob_deflatehandler
);
236 PHP_FUNCTION(ob_inflatehandler
);
238 PHP_FUNCTION(http_support
);
240 #endif /* PHP_HTTP_H */
247 * vim600: noet sw=4 ts=4 fdm=marker
248 * vim<600: noet sw=4 ts=4