4e2a7c67bc5e0c2b49f418b354c39224af60e1b8
[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.0RC5-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 # 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 # ifdef HAVE_UNISTD_H
51 # include <unistd.h>
52 # endif
53 # endif
54 #endif
55
56 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
57 # ifdef PHP_WIN32
58 # include <winsock2.h>
59 # define CURL_STATICLIB
60 # endif
61 # include <curl/curl.h>
62 # define HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z)))
63 #endif
64
65 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
66 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
67 # define USE_MAGIC_STATIC
68 # endif
69 # include <magic.h>
70 #endif
71
72 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
73 # include <zlib.h>
74 #endif
75
76 #include <ctype.h>
77
78 extern zend_module_entry http_module_entry;
79 #define phpext_http_ptr &http_module_entry
80
81 extern int http_module_number;
82
83 ZEND_BEGIN_MODULE_GLOBALS(http)
84
85 struct _http_globals_etag {
86 char *mode;
87 void *ctx;
88 zend_bool started;
89 } etag;
90
91 struct _http_globals_log {
92 char *cache;
93 char *redirect;
94 char *allowed_methods;
95 char *composite;
96 } log;
97
98 struct _http_globals_send {
99 double throttle_delay;
100 size_t buffer_size;
101 char *content_type;
102 char *unquoted_etag;
103 time_t last_modified;
104 struct _http_globals_send_deflate {
105 zend_bool start_auto;
106 long start_flags;
107 int encoding;
108 void *stream;
109 } deflate;
110 struct _http_globals_send_inflate {
111 zend_bool start_auto;
112 long start_flags;
113 void *stream;
114 } inflate;
115 } send;
116
117 struct _http_globals_request {
118 struct _http_globals_request_methods {
119 char *allowed;
120 struct _http_globals_request_methods_custom {
121 char *ini;
122 int count;
123 void *entries;
124 } custom;
125 } methods;
126 } request;
127
128 #ifndef HTTP_HAVE_SAPI_RTIME
129 time_t request_time;
130 #endif
131 #ifdef ZEND_ENGINE_2
132 zend_bool only_exceptions;
133 #endif
134
135 zend_bool force_exit;
136 zend_bool read_post_data;
137
138 ZEND_END_MODULE_GLOBALS(http)
139
140 ZEND_EXTERN_MODULE_GLOBALS(http);
141
142 #ifdef ZTS
143 # include "TSRM.h"
144 # define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
145 #else
146 # define HTTP_G (&http_globals)
147 #endif
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 PHP_FUNCTION(http_request_body_encode);
188 #endif /* HTTP_HAVE_CURL */
189 PHP_FUNCTION(http_request_method_register);
190 PHP_FUNCTION(http_request_method_unregister);
191 PHP_FUNCTION(http_request_method_exists);
192 PHP_FUNCTION(http_request_method_name);
193 PHP_FUNCTION(ob_etaghandler);
194 #ifdef HTTP_HAVE_ZLIB
195 PHP_FUNCTION(http_deflate);
196 PHP_FUNCTION(http_inflate);
197 PHP_FUNCTION(ob_deflatehandler);
198 PHP_FUNCTION(ob_inflatehandler);
199 #endif
200 PHP_FUNCTION(http_support);
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