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_HTTP_VERSION "1.6.5"
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)))
61 # if defined(HTTP_WANT_EVENT) && defined(HTTP_HAVE_EVENT)
66 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
67 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
68 # define USE_MAGIC_STATIC
73 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
78 #define HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c))
79 #define HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c))
81 extern zend_module_entry http_module_entry
;
82 #define phpext_http_ptr &http_module_entry
84 extern int http_module_number
;
86 ZEND_BEGIN_MODULE_GLOBALS(http
)
88 struct _http_globals_etag
{
94 struct _http_globals_log
{
98 char *allowed_methods
;
102 struct _http_globals_send
{
103 double throttle_delay
;
107 time_t last_modified
;
108 struct _http_globals_send_deflate
{
110 zend_bool start_auto
;
115 struct _http_globals_send_inflate
{
116 zend_bool start_auto
;
120 zend_bool not_found_404
;
123 struct _http_globals_request
{
126 struct _http_globals_request_methods
{
127 HashTable registered
;
131 #if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL)
132 struct _http_globals_request_datashare
{
140 #if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_EVENT)
141 struct _http_globals_request_pool
{
142 struct _http_globals_request_pool_event
{
149 struct _http_globals_persistent
{
150 struct _http_globals_persistent_handles
{
152 struct _http_globals_persistent_handles_ident
{
161 zend_bool only_exceptions
;
164 zend_bool force_exit
;
165 zend_bool read_post_data
;
168 ZEND_END_MODULE_GLOBALS(http
)
170 ZEND_EXTERN_MODULE_GLOBALS(http
);
174 # define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
176 # define HTTP_G (&http_globals)
179 #if defined(HAVE_ICONV) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
180 # define HTTP_HAVE_ICONV
183 #if defined(HAVE_PHP_SESSION) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_SESSION))
184 # define HTTP_HAVE_SESSION
187 #if defined(HAVE_HASH_EXT) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_HASH)) && defined(HTTP_HAVE_PHP_HASH_H)
188 # define HTTP_HAVE_HASH
191 #if defined(HAVE_SPL)
192 # define HTTP_HAVE_SPL
195 PHP_FUNCTION(http_date
);
196 PHP_FUNCTION(http_build_url
);
197 PHP_FUNCTION(http_build_str
);
198 PHP_FUNCTION(http_negotiate_language
);
199 PHP_FUNCTION(http_negotiate_charset
);
200 PHP_FUNCTION(http_negotiate_content_type
);
201 PHP_FUNCTION(http_redirect
);
202 PHP_FUNCTION(http_throttle
);
203 PHP_FUNCTION(http_send_status
);
204 PHP_FUNCTION(http_send_last_modified
);
205 PHP_FUNCTION(http_send_content_type
);
206 PHP_FUNCTION(http_send_content_disposition
);
207 PHP_FUNCTION(http_match_modified
);
208 PHP_FUNCTION(http_match_etag
);
209 PHP_FUNCTION(http_cache_last_modified
);
210 PHP_FUNCTION(http_cache_etag
);
211 PHP_FUNCTION(http_send_data
);
212 PHP_FUNCTION(http_send_file
);
213 PHP_FUNCTION(http_send_stream
);
214 PHP_FUNCTION(http_chunked_decode
);
215 PHP_FUNCTION(http_parse_message
);
216 PHP_FUNCTION(http_parse_headers
);
217 PHP_FUNCTION(http_parse_cookie
);
218 PHP_FUNCTION(http_build_cookie
);
219 PHP_FUNCTION(http_parse_params
);
220 PHP_FUNCTION(http_get_request_headers
);
221 PHP_FUNCTION(http_get_request_body
);
222 PHP_FUNCTION(http_get_request_body_stream
);
223 PHP_FUNCTION(http_match_request_header
);
224 PHP_FUNCTION(http_persistent_handles_count
);
225 PHP_FUNCTION(http_persistent_handles_clean
);
226 PHP_FUNCTION(http_persistent_handles_ident
);
227 #ifdef HTTP_HAVE_CURL
228 PHP_FUNCTION(http_get
);
229 PHP_FUNCTION(http_head
);
230 PHP_FUNCTION(http_post_data
);
231 PHP_FUNCTION(http_post_fields
);
232 PHP_FUNCTION(http_put_data
);
233 PHP_FUNCTION(http_put_file
);
234 PHP_FUNCTION(http_put_stream
);
235 PHP_FUNCTION(http_request
);
236 PHP_FUNCTION(http_request_body_encode
);
237 #endif /* HTTP_HAVE_CURL */
238 PHP_FUNCTION(http_request_method_register
);
239 PHP_FUNCTION(http_request_method_unregister
);
240 PHP_FUNCTION(http_request_method_exists
);
241 PHP_FUNCTION(http_request_method_name
);
242 PHP_FUNCTION(ob_etaghandler
);
243 #ifdef HTTP_HAVE_ZLIB
244 PHP_FUNCTION(http_deflate
);
245 PHP_FUNCTION(http_inflate
);
246 PHP_FUNCTION(ob_deflatehandler
);
247 PHP_FUNCTION(ob_inflatehandler
);
249 PHP_FUNCTION(http_support
);
251 #endif /* PHP_HTTP_H */
258 * vim600: noet sw=4 ts=4 fdm=marker
259 * vim<600: noet sw=4 ts=4