- add flag parameter to http_build_url(); slightly breaks parameter order
[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 "0.22.0-dev"
19
20 #ifdef HAVE_CONFIG_H
21 # include "config.h"
22 #else
23 # include "php_config.h"
24 #endif
25
26 #include "php.h"
27 #include "php_http_std_defs.h"
28 #include "phpstr/phpstr.h"
29 #include "missing.h"
30
31 #ifdef HTTP_WANT_SAPI
32 # if PHP_API_VERSION > 20041225
33 # define HTTP_HAVE_SAPI_RTIME
34 # define HTTP_GET_REQUEST_TIME() sapi_get_request_time(TSRMLS_C)
35 # else
36 # define HTTP_GET_REQUEST_TIME() HTTP_G(request_time)
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 # endif
49 #endif
50
51 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
52 # ifdef PHP_WIN32
53 # include <winsock2.h>
54 # define CURL_STATICLIB
55 # endif
56 # include <curl/curl.h>
57 #endif
58
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
62 # endif
63 # include <magic.h>
64 #endif
65
66 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
67 # include <zlib.h>
68 #endif
69
70 #include <ctype.h>
71
72 extern zend_module_entry http_module_entry;
73 #define phpext_http_ptr &http_module_entry
74
75 extern int http_module_number;
76
77 ZEND_BEGIN_MODULE_GLOBALS(http)
78
79 struct _http_globals_etag {
80 char *mode;
81 void *ctx;
82 zend_bool started;
83 } etag;
84
85 struct _http_globals_log {
86 char *cache;
87 char *redirect;
88 char *allowed_methods;
89 char *composite;
90 } log;
91
92 struct _http_globals_send {
93 double throttle_delay;
94 size_t buffer_size;
95 char *content_type;
96 char *unquoted_etag;
97 time_t last_modified;
98 struct _http_globals_send_deflate {
99 zend_bool start_auto;
100 long start_flags;
101 int encoding;
102 void *stream;
103 } deflate;
104 struct _http_globals_send_inflate {
105 zend_bool start_auto;
106 long start_flags;
107 void *stream;
108 } inflate;
109 } send;
110
111 struct _http_globals_request {
112 struct _http_globals_request_methods {
113 char *allowed;
114 struct _http_globals_request_methods_custom {
115 int count;
116 void *entries;
117 } custom;
118 } methods;
119 } request;
120
121 #ifndef HTTP_HAVE_SAPI_RTIME
122 time_t request_time;
123 #endif
124 #ifdef ZEND_ENGINE_2
125 zend_bool only_exceptions;
126 #endif
127
128 zend_bool force_exit;
129 zend_bool read_post_data;
130
131 ZEND_END_MODULE_GLOBALS(http)
132
133 ZEND_EXTERN_MODULE_GLOBALS(http);
134
135 #ifdef ZTS
136 # include "TSRM.h"
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)])
139 #else
140 # define HTTP_G(v) (http_globals.v)
141 # define HTTP_GLOBALS (&http_globals)
142 #endif
143 #define getGlobals(G) zend_http_globals *G = HTTP_GLOBALS
144
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);
193 #endif
194 PHP_FUNCTION(http_support);
195
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);
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