- ws
[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.25.0"
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 int count;
122 void *entries;
123 } custom;
124 } methods;
125 } request;
126
127 #ifndef HTTP_HAVE_SAPI_RTIME
128 time_t request_time;
129 #endif
130 #ifdef ZEND_ENGINE_2
131 zend_bool only_exceptions;
132 #endif
133
134 zend_bool force_exit;
135 zend_bool read_post_data;
136
137 ZEND_END_MODULE_GLOBALS(http)
138
139 ZEND_EXTERN_MODULE_GLOBALS(http);
140
141 #ifdef ZTS
142 # include "TSRM.h"
143 # define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
144 #else
145 # define HTTP_G (&http_globals)
146 #endif
147
148 PHP_FUNCTION(http_test);
149 PHP_FUNCTION(http_date);
150 PHP_FUNCTION(http_build_url);
151 PHP_FUNCTION(http_build_str);
152 PHP_FUNCTION(http_negotiate_language);
153 PHP_FUNCTION(http_negotiate_charset);
154 PHP_FUNCTION(http_negotiate_content_type);
155 PHP_FUNCTION(http_redirect);
156 PHP_FUNCTION(http_throttle);
157 PHP_FUNCTION(http_send_status);
158 PHP_FUNCTION(http_send_last_modified);
159 PHP_FUNCTION(http_send_content_type);
160 PHP_FUNCTION(http_send_content_disposition);
161 PHP_FUNCTION(http_match_modified);
162 PHP_FUNCTION(http_match_etag);
163 PHP_FUNCTION(http_cache_last_modified);
164 PHP_FUNCTION(http_cache_etag);
165 PHP_FUNCTION(http_send_data);
166 PHP_FUNCTION(http_send_file);
167 PHP_FUNCTION(http_send_stream);
168 PHP_FUNCTION(http_chunked_decode);
169 PHP_FUNCTION(http_parse_message);
170 PHP_FUNCTION(http_parse_headers);
171 PHP_FUNCTION(http_parse_cookie);
172 PHP_FUNCTION(http_get_request_headers);
173 PHP_FUNCTION(http_get_request_body);
174 PHP_FUNCTION(http_get_request_body_stream);
175 PHP_FUNCTION(http_match_request_header);
176 #ifdef HTTP_HAVE_CURL
177 PHP_FUNCTION(http_get);
178 PHP_FUNCTION(http_head);
179 PHP_FUNCTION(http_post_data);
180 PHP_FUNCTION(http_post_fields);
181 PHP_FUNCTION(http_put_data);
182 PHP_FUNCTION(http_put_file);
183 PHP_FUNCTION(http_put_stream);
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