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-2006, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
15 #ifndef PHP_EXT_HTTP_H
16 #define PHP_EXT_HTTP_H
18 #define PHP_EXT_HTTP_VERSION "0.22.0-dev"
23 # include "php_config.h"
27 #include "php_http_std_defs.h"
28 #include "phpstr/phpstr.h"
32 # if PHP_API_VERSION > 20041225
33 # define HTTP_HAVE_SAPI_RTIME
34 # define HTTP_GET_REQUEST_TIME() sapi_get_request_time(TSRMLS_C)
36 # define HTTP_GET_REQUEST_TIME() HTTP_G(request_time)
41 #ifdef HTTP_WANT_NETDB
43 # define HTTP_HAVE_NETDB
44 # include <winsock2.h>
45 # elif defined(HAVE_NETDB_H)
46 # define HTTP_HAVE_NETDB
51 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
53 # include <winsock2.h>
54 # define CURL_STATICLIB
56 # include <curl/curl.h>
59 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
60 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
61 # define USE_MAGIC_STATIC
66 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
72 extern zend_module_entry http_module_entry
;
73 #define phpext_http_ptr &http_module_entry
75 extern int http_module_number
;
77 ZEND_BEGIN_MODULE_GLOBALS(http
)
79 struct _http_globals_etag
{
85 struct _http_globals_log
{
88 char *allowed_methods
;
92 struct _http_globals_send
{
93 double throttle_delay
;
98 struct _http_globals_send_deflate
{
104 struct _http_globals_send_inflate
{
105 zend_bool start_auto
;
111 struct _http_globals_request
{
112 struct _http_globals_request_methods
{
114 struct _http_globals_request_methods_custom
{
121 #ifndef HTTP_HAVE_SAPI_RTIME
125 zend_bool only_exceptions
;
128 zend_bool force_exit
;
129 zend_bool read_post_data
;
131 ZEND_END_MODULE_GLOBALS(http
)
133 ZEND_EXTERN_MODULE_GLOBALS(http
);
137 # define HTTP_G(v) TSRMG(http_globals_id, zend_http_globals *, v)
138 # define HTTP_GLOBALS ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
140 # define HTTP_G(v) (http_globals.v)
141 # define HTTP_GLOBALS (&http_globals)
143 #define getGlobals(G) zend_http_globals *G = HTTP_GLOBALS
145 PHP_FUNCTION(http_test
);
146 PHP_FUNCTION(http_date
);
147 PHP_FUNCTION(http_build_url
);
148 PHP_FUNCTION(http_negotiate_language
);
149 PHP_FUNCTION(http_negotiate_charset
);
150 PHP_FUNCTION(http_negotiate_content_type
);
151 PHP_FUNCTION(http_redirect
);
152 PHP_FUNCTION(http_throttle
);
153 PHP_FUNCTION(http_send_status
);
154 PHP_FUNCTION(http_send_last_modified
);
155 PHP_FUNCTION(http_send_content_type
);
156 PHP_FUNCTION(http_send_content_disposition
);
157 PHP_FUNCTION(http_match_modified
);
158 PHP_FUNCTION(http_match_etag
);
159 PHP_FUNCTION(http_cache_last_modified
);
160 PHP_FUNCTION(http_cache_etag
);
161 PHP_FUNCTION(http_send_data
);
162 PHP_FUNCTION(http_send_file
);
163 PHP_FUNCTION(http_send_stream
);
164 PHP_FUNCTION(http_chunked_decode
);
165 PHP_FUNCTION(http_parse_message
);
166 PHP_FUNCTION(http_parse_headers
);
167 PHP_FUNCTION(http_parse_cookie
);
168 PHP_FUNCTION(http_get_request_headers
);
169 PHP_FUNCTION(http_get_request_body
);
170 PHP_FUNCTION(http_get_request_body_stream
);
171 PHP_FUNCTION(http_match_request_header
);
172 #ifdef HTTP_HAVE_CURL
173 PHP_FUNCTION(http_get
);
174 PHP_FUNCTION(http_head
);
175 PHP_FUNCTION(http_post_data
);
176 PHP_FUNCTION(http_post_fields
);
177 PHP_FUNCTION(http_put_file
);
178 PHP_FUNCTION(http_put_stream
);
179 #endif /* HTTP_HAVE_CURL */
180 PHP_FUNCTION(http_request_method_register
);
181 PHP_FUNCTION(http_request_method_unregister
);
182 PHP_FUNCTION(http_request_method_exists
);
183 PHP_FUNCTION(http_request_method_name
);
184 #ifndef ZEND_ENGINE_2
185 PHP_FUNCTION(http_build_query
);
186 #endif /* ZEND_ENGINE_2 */
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
);
194 PHP_FUNCTION(http_support
);
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
);
202 #endif /* PHP_HTTP_H */
209 * vim600: noet sw=4 ts=4 fdm=marker
210 * vim<600: noet sw=4 ts=4