- fix usage of request time
[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 # else
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 # ifdef HAVE_UNISTD_H
49 # include <unistd.h>
50 # endif
51 # endif
52 #endif
53
54 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
55 # ifdef PHP_WIN32
56 # include <winsock2.h>
57 # define CURL_STATICLIB
58 # endif
59 # include <curl/curl.h>
60 # define HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z)))
61 #endif
62
63 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
64 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
65 # define USE_MAGIC_STATIC
66 # endif
67 # include <magic.h>
68 #endif
69
70 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
71 # include <zlib.h>
72 #endif
73
74 #include <ctype.h>
75
76 extern zend_module_entry http_module_entry;
77 #define phpext_http_ptr &http_module_entry
78
79 extern int http_module_number;
80
81 ZEND_BEGIN_MODULE_GLOBALS(http)
82
83 struct _http_globals_etag {
84 char *mode;
85 void *ctx;
86 zend_bool started;
87 } etag;
88
89 struct _http_globals_log {
90 char *cache;
91 char *redirect;
92 char *allowed_methods;
93 char *composite;
94 } log;
95
96 struct _http_globals_send {
97 double throttle_delay;
98 size_t buffer_size;
99 char *content_type;
100 char *unquoted_etag;
101 time_t last_modified;
102 struct _http_globals_send_deflate {
103 zend_bool start_auto;
104 long start_flags;
105 int encoding;
106 void *stream;
107 } deflate;
108 struct _http_globals_send_inflate {
109 zend_bool start_auto;
110 long start_flags;
111 void *stream;
112 } inflate;
113 } send;
114
115 struct _http_globals_request {
116 time_t time;
117 struct _http_globals_request_methods {
118 char *allowed;
119 struct _http_globals_request_methods_custom {
120 char *ini;
121 int count;
122 void *entries;
123 } custom;
124 } methods;
125 } request;
126
127 #ifdef ZEND_ENGINE_2
128 zend_bool only_exceptions;
129 #endif
130
131 zend_bool force_exit;
132 zend_bool read_post_data;
133
134 ZEND_END_MODULE_GLOBALS(http)
135
136 ZEND_EXTERN_MODULE_GLOBALS(http);
137
138 #ifdef ZTS
139 # include "TSRM.h"
140 # define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
141 #else
142 # define HTTP_G (&http_globals)
143 #endif
144
145 PHP_FUNCTION(http_test);
146 PHP_FUNCTION(http_date);
147 PHP_FUNCTION(http_build_url);
148 PHP_FUNCTION(http_build_str);
149 PHP_FUNCTION(http_negotiate_language);
150 PHP_FUNCTION(http_negotiate_charset);
151 PHP_FUNCTION(http_negotiate_content_type);
152 PHP_FUNCTION(http_redirect);
153 PHP_FUNCTION(http_throttle);
154 PHP_FUNCTION(http_send_status);
155 PHP_FUNCTION(http_send_last_modified);
156 PHP_FUNCTION(http_send_content_type);
157 PHP_FUNCTION(http_send_content_disposition);
158 PHP_FUNCTION(http_match_modified);
159 PHP_FUNCTION(http_match_etag);
160 PHP_FUNCTION(http_cache_last_modified);
161 PHP_FUNCTION(http_cache_etag);
162 PHP_FUNCTION(http_send_data);
163 PHP_FUNCTION(http_send_file);
164 PHP_FUNCTION(http_send_stream);
165 PHP_FUNCTION(http_chunked_decode);
166 PHP_FUNCTION(http_parse_message);
167 PHP_FUNCTION(http_parse_headers);
168 PHP_FUNCTION(http_parse_cookie);
169 PHP_FUNCTION(http_parse_params);
170 PHP_FUNCTION(http_get_request_headers);
171 PHP_FUNCTION(http_get_request_body);
172 PHP_FUNCTION(http_get_request_body_stream);
173 PHP_FUNCTION(http_match_request_header);
174 #ifdef HTTP_HAVE_CURL
175 PHP_FUNCTION(http_get);
176 PHP_FUNCTION(http_head);
177 PHP_FUNCTION(http_post_data);
178 PHP_FUNCTION(http_post_fields);
179 PHP_FUNCTION(http_put_data);
180 PHP_FUNCTION(http_put_file);
181 PHP_FUNCTION(http_put_stream);
182 PHP_FUNCTION(http_request);
183 PHP_FUNCTION(http_request_body_encode);
184 #endif /* HTTP_HAVE_CURL */
185 PHP_FUNCTION(http_request_method_register);
186 PHP_FUNCTION(http_request_method_unregister);
187 PHP_FUNCTION(http_request_method_exists);
188 PHP_FUNCTION(http_request_method_name);
189 PHP_FUNCTION(ob_etaghandler);
190 #ifdef HTTP_HAVE_ZLIB
191 PHP_FUNCTION(http_deflate);
192 PHP_FUNCTION(http_inflate);
193 PHP_FUNCTION(ob_deflatehandler);
194 PHP_FUNCTION(ob_inflatehandler);
195 #endif
196 PHP_FUNCTION(http_support);
197
198 #endif /* PHP_HTTP_H */
199
200 /*
201 * Local variables:
202 * tab-width: 4
203 * c-basic-offset: 4
204 * End:
205 * vim600: noet sw=4 ts=4 fdm=marker
206 * vim<600: noet sw=4 ts=4
207 */
208