* satisfy gcc
[m6w6/ext-http] / php_http.h
1 /*
2 +----------------------------------------------------------------------+
3 | PECL :: http |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.0 of the PHP license, that |
6 | is bundled with this package in the file LICENSE, and is available |
7 | through the world-wide-web at http://www.php.net/license/3_0.txt. |
8 | If you did not receive a copy of the PHP license and are unable to |
9 | obtain it through the world-wide-web, please send a note to |
10 | license@php.net so we can mail you a copy immediately. |
11 +----------------------------------------------------------------------+
12 | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
13 +----------------------------------------------------------------------+
14 */
15
16 /* $Id$ */
17
18 #ifndef PHP_EXT_HTTP_H
19 #define PHP_EXT_HTTP_H
20
21 #define HTTP_PEXT_VERSION "0.7.0"
22
23 /* make compile on Win32 */
24 #include "php_streams.h"
25 #include "ext/standard/md5.h"
26 #include "phpstr/phpstr.h"
27
28 extern zend_module_entry http_module_entry;
29 #define phpext_http_ptr &http_module_entry
30
31 #ifdef ZTS
32 # include "TSRM.h"
33 # define HTTP_G(v) TSRMG(http_globals_id, zend_http_globals *, v)
34 #else
35 # define HTTP_G(v) (http_globals.v)
36 #endif
37
38 #ifdef ZEND_ENGINE_2
39
40 typedef struct {
41 zend_object zo;
42 } http_response_object;
43
44 #ifdef HTTP_HAVE_CURL
45
46 #ifdef PHP_WIN32
47 # include <winsock2.h>
48 #endif
49
50 #include <curl/curl.h>
51
52 typedef struct {
53 zend_object zo;
54 CURL *ch;
55 } http_request_object;
56
57 typedef enum {
58 HTTP_GET = 1,
59 HTTP_HEAD,
60 HTTP_POST,
61 } http_request_method;
62
63 #endif /* HTTP_HAVE _CURL */
64
65 PHP_METHOD(HttpUtil, date);
66 PHP_METHOD(HttpUtil, absoluteURI);
67 PHP_METHOD(HttpUtil, negotiateLanguage);
68 PHP_METHOD(HttpUtil, negotiateCharset);
69 PHP_METHOD(HttpUtil, redirect);
70 PHP_METHOD(HttpUtil, sendStatus);
71 PHP_METHOD(HttpUtil, sendLastModified);
72 PHP_METHOD(HttpUtil, sendContentType);
73 PHP_METHOD(HttpUtil, sendContentDisposition);
74 PHP_METHOD(HttpUtil, matchModified);
75 PHP_METHOD(HttpUtil, matchEtag);
76 PHP_METHOD(HttpUtil, cacheLastModified);
77 PHP_METHOD(HttpUtil, cacheEtag);
78 PHP_METHOD(HttpUtil, chunkedDecode);
79 PHP_METHOD(HttpUtil, splitResponse);
80 PHP_METHOD(HttpUtil, parseHeaders);
81 PHP_METHOD(HttpUtil, getRequestHeaders);
82 #ifdef HTTP_HAVE_CURL
83 PHP_METHOD(HttpUtil, get);
84 PHP_METHOD(HttpUtil, head);
85 PHP_METHOD(HttpUtil, postData);
86 PHP_METHOD(HttpUtil, postArray);
87 #endif /* HTTP_HAVE_CURL */
88 PHP_METHOD(HttpUtil, authBasic);
89 PHP_METHOD(HttpUtil, authBasicCallback);
90
91
92 PHP_METHOD(HttpResponse, __construct);/*
93 PHP_METHOD(HttpResponse, __destruct);*/
94 PHP_METHOD(HttpResponse, setETag);
95 PHP_METHOD(HttpResponse, getETag);
96 PHP_METHOD(HttpResponse, setContentDisposition);
97 PHP_METHOD(HttpResponse, getContentDisposition);
98 PHP_METHOD(HttpResponse, setContentType);
99 PHP_METHOD(HttpResponse, getContentType);
100 PHP_METHOD(HttpResponse, setCache);
101 PHP_METHOD(HttpResponse, getCache);
102 PHP_METHOD(HttpResponse, setCacheControl);
103 PHP_METHOD(HttpResponse, getCacheControl);
104 PHP_METHOD(HttpResponse, setGzip);
105 PHP_METHOD(HttpResponse, getGzip);
106 PHP_METHOD(HttpResponse, setData);
107 PHP_METHOD(HttpResponse, getData);
108 PHP_METHOD(HttpResponse, setFile);
109 PHP_METHOD(HttpResponse, getFile);
110 PHP_METHOD(HttpResponse, setStream);
111 PHP_METHOD(HttpResponse, getStream);
112 PHP_METHOD(HttpResponse, send);
113
114 #ifdef HTTP_HAVE_CURL
115
116 PHP_METHOD(HttpRequest, __construct);
117 PHP_METHOD(HttpRequest, __destruct);
118 PHP_METHOD(HttpRequest, setOptions);
119 PHP_METHOD(HttpRequest, getOptions);
120 PHP_METHOD(HttpRequest, unsetOptions);
121 PHP_METHOD(HttpRequest, setSslOptions);
122 PHP_METHOD(HttpRequest, getSslOptions);
123 PHP_METHOD(HttpRequest, unsetSslOptions);
124 PHP_METHOD(HttpRequest, addHeaders);
125 PHP_METHOD(HttpRequest, getHeaders);
126 PHP_METHOD(HttpRequest, unsetHeaders);
127 PHP_METHOD(HttpRequest, addCookies);
128 PHP_METHOD(HttpRequest, getCookies);
129 PHP_METHOD(HttpRequest, unsetCookies);
130 PHP_METHOD(HttpRequest, setMethod);
131 PHP_METHOD(HttpRequest, getMethod);
132 PHP_METHOD(HttpRequest, setURL);
133 PHP_METHOD(HttpRequest, getURL);
134 PHP_METHOD(HttpRequest, setContentType);
135 PHP_METHOD(HttpRequest, getContentType);
136 PHP_METHOD(HttpRequest, setQueryData);
137 PHP_METHOD(HttpRequest, getQueryData);
138 PHP_METHOD(HttpRequest, addQueryData);
139 PHP_METHOD(HttpRequest, unsetQueryData);
140 PHP_METHOD(HttpRequest, setPostData);
141 PHP_METHOD(HttpRequest, getPostData);
142 PHP_METHOD(HttpRequest, addPostData);
143 PHP_METHOD(HttpRequest, unsetPostData);
144 PHP_METHOD(HttpRequest, addPostFile);
145 PHP_METHOD(HttpRequest, getPostFiles);
146 PHP_METHOD(HttpRequest, unsetPostFiles);
147 PHP_METHOD(HttpRequest, send);
148 PHP_METHOD(HttpRequest, getResponseData);
149 PHP_METHOD(HttpRequest, getResponseHeader);
150 PHP_METHOD(HttpRequest, getResponseCookie);
151 PHP_METHOD(HttpRequest, getResponseCode);
152 PHP_METHOD(HttpRequest, getResponseBody);
153 PHP_METHOD(HttpRequest, getResponseInfo);
154
155 #endif /* HTTP_HAVE_CURL */
156
157 #endif /* ZEND_ENGINE_2 */
158
159 PHP_FUNCTION(http_test);
160 PHP_FUNCTION(http_date);
161 PHP_FUNCTION(http_absolute_uri);
162 PHP_FUNCTION(http_negotiate_language);
163 PHP_FUNCTION(http_negotiate_charset);
164 PHP_FUNCTION(http_redirect);
165 PHP_FUNCTION(http_send_status);
166 PHP_FUNCTION(http_send_last_modified);
167 PHP_FUNCTION(http_send_content_type);
168 PHP_FUNCTION(http_send_content_disposition);
169 PHP_FUNCTION(http_match_modified);
170 PHP_FUNCTION(http_match_etag);
171 PHP_FUNCTION(http_cache_last_modified);
172 PHP_FUNCTION(http_cache_etag);
173 PHP_FUNCTION(http_send_data);
174 PHP_FUNCTION(http_send_file);
175 PHP_FUNCTION(http_send_stream);
176 PHP_FUNCTION(http_chunked_decode);
177 PHP_FUNCTION(http_split_response);
178 PHP_FUNCTION(http_parse_headers);
179 PHP_FUNCTION(http_get_request_headers);
180 #ifdef HTTP_HAVE_CURL
181 PHP_FUNCTION(http_get);
182 PHP_FUNCTION(http_head);
183 PHP_FUNCTION(http_post_data);
184 PHP_FUNCTION(http_post_array);
185 #endif /* HTTP_HAVE_CURL */
186 PHP_FUNCTION(http_auth_basic);
187 PHP_FUNCTION(http_auth_basic_cb);
188 #ifndef ZEND_ENGINE_2
189 PHP_FUNCTION(http_build_query);
190 #endif /* ZEND_ENGINE_2 */
191 PHP_FUNCTION(ob_httpetaghandler);
192
193 PHP_MINIT_FUNCTION(http);
194 PHP_MSHUTDOWN_FUNCTION(http);
195 PHP_RINIT_FUNCTION(http);
196 PHP_RSHUTDOWN_FUNCTION(http);
197 PHP_MINFO_FUNCTION(http);
198
199 ZEND_BEGIN_MODULE_GLOBALS(http)
200 zend_bool etag_started;
201 PHP_MD5_CTX etag_md5;
202 php_stream_statbuf ssb;
203 char *ctype;
204 char *etag;
205 time_t lmod;
206 char *allowed_methods;
207 #ifdef HTTP_HAVE_CURL
208 phpstr curlbuf;
209 zend_llist to_free;
210 #endif /* HTTP_HAVE_CURL */
211 ZEND_END_MODULE_GLOBALS(http)
212
213 #endif /* PHP_HTTP_H */
214
215 /*
216 * Local variables:
217 * tab-width: 4
218 * c-basic-offset: 4
219 * End:
220 * vim600: noet sw=4 ts=4 fdm=marker
221 * vim<600: noet sw=4 ts=4
222 */
223