* simplify HTTPi_Response::send() a lot
[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 PHP_EXT_HTTP_VERSION "0.5.0-dev"
22
23 /* make compile on Win32 */
24 #include "php_streams.h"
25 #include "ext/standard/md5.h"
26
27 extern zend_module_entry http_module_entry;
28 #define phpext_http_ptr &http_module_entry
29
30 #ifdef ZTS
31 # include "TSRM.h"
32 # define HTTP_G(v) TSRMG(http_globals_id, zend_http_globals *, v)
33 #else
34 # define HTTP_G(v) (http_globals.v)
35 #endif
36
37 #ifndef ZEND_ENGINE_2
38 # include "php_http_build_query.h"
39 #else
40
41 PHP_METHOD(HTTPi, date);
42 PHP_METHOD(HTTPi, absoluteURI);
43 PHP_METHOD(HTTPi, negotiateLanguage);
44 PHP_METHOD(HTTPi, negotiateCharset);
45 PHP_METHOD(HTTPi, redirect);
46 PHP_METHOD(HTTPi, sendStatus);
47 PHP_METHOD(HTTPi, sendLastModified);
48 PHP_METHOD(HTTPi, sendContentType);
49 PHP_METHOD(HTTPi, sendContentDisposition);
50 PHP_METHOD(HTTPi, matchModified);
51 PHP_METHOD(HTTPi, matchEtag);
52 PHP_METHOD(HTTPi, cacheLastModified);
53 PHP_METHOD(HTTPi, cacheEtag);
54 PHP_METHOD(HTTPi, chunkedDecode);
55 PHP_METHOD(HTTPi, splitResponse);
56 PHP_METHOD(HTTPi, parseHeaders);
57 PHP_METHOD(HTTPi, getRequestHeaders);
58 #ifdef HTTP_HAVE_CURL
59 PHP_METHOD(HTTPi, get);
60 PHP_METHOD(HTTPi, head);
61 PHP_METHOD(HTTPi, postData);
62 PHP_METHOD(HTTPi, postArray);
63 #endif
64 PHP_METHOD(HTTPi, authBasic);
65 PHP_METHOD(HTTPi, authBasicCallback);
66
67
68 PHP_METHOD(HTTPi_Response, __construct);/*
69 PHP_METHOD(HTTPi_Response, __destruct);*/
70 PHP_METHOD(HTTPi_Response, setETag);
71 PHP_METHOD(HTTPi_Response, getETag);
72 PHP_METHOD(HTTPi_Response, setContentDisposition);
73 PHP_METHOD(HTTPi_Response, getContentDisposition);
74 PHP_METHOD(HTTPi_Response, setContentType);
75 PHP_METHOD(HTTPi_Response, getContentType);
76 PHP_METHOD(HTTPi_Response, setCache);
77 PHP_METHOD(HTTPi_Response, getCache);
78 PHP_METHOD(HTTPi_Response, setCacheControl);
79 PHP_METHOD(HTTPi_Response, getCacheControl);
80 PHP_METHOD(HTTPi_Response, setGzip);
81 PHP_METHOD(HTTPi_Response, getGzip);
82 PHP_METHOD(HTTPi_Response, setData);
83 PHP_METHOD(HTTPi_Response, getData);
84 PHP_METHOD(HTTPi_Response, setFile);
85 PHP_METHOD(HTTPi_Response, getFile);
86 PHP_METHOD(HTTPi_Response, setStream);
87 PHP_METHOD(HTTPi_Response, getStream);
88 PHP_METHOD(HTTPi_Response, send);
89
90 #endif /* ZEND_ENGINE_2 */
91
92
93 PHP_FUNCTION(http_date);
94 PHP_FUNCTION(http_absolute_uri);
95 PHP_FUNCTION(http_negotiate_language);
96 PHP_FUNCTION(http_negotiate_charset);
97 PHP_FUNCTION(http_redirect);
98 PHP_FUNCTION(http_send_status);
99 PHP_FUNCTION(http_send_last_modified);
100 PHP_FUNCTION(http_send_content_type);
101 PHP_FUNCTION(http_send_content_disposition);
102 PHP_FUNCTION(http_match_modified);
103 PHP_FUNCTION(http_match_etag);
104 PHP_FUNCTION(http_cache_last_modified);
105 PHP_FUNCTION(http_cache_etag);
106 PHP_FUNCTION(http_send_data);
107 PHP_FUNCTION(http_send_file);
108 PHP_FUNCTION(http_send_stream);
109 PHP_FUNCTION(http_chunked_decode);
110 PHP_FUNCTION(http_split_response);
111 PHP_FUNCTION(http_parse_headers);
112 PHP_FUNCTION(http_get_request_headers);
113 #ifdef HTTP_HAVE_CURL
114 PHP_FUNCTION(http_get);
115 PHP_FUNCTION(http_head);
116 PHP_FUNCTION(http_post_data);
117 PHP_FUNCTION(http_post_array);
118 #endif
119 PHP_FUNCTION(http_auth_basic);
120 PHP_FUNCTION(http_auth_basic_cb);
121
122 PHP_FUNCTION(ob_httpetaghandler);
123
124 PHP_MINIT_FUNCTION(http);
125 PHP_MSHUTDOWN_FUNCTION(http);
126 PHP_RINIT_FUNCTION(http);
127 PHP_RSHUTDOWN_FUNCTION(http);
128 PHP_MINFO_FUNCTION(http);
129
130 ZEND_BEGIN_MODULE_GLOBALS(http)
131 zend_bool etag_started;
132 PHP_MD5_CTX etag_md5;
133 php_stream_statbuf ssb;
134 char *ctype;
135 char *etag;
136 time_t lmod;
137 char *allowed_methods;
138 #ifdef HTTP_HAVE_CURL
139 struct {
140 struct {
141 char *data;
142 size_t used;
143 size_t free;
144 } body;
145 struct {
146 char *data;
147 size_t used;
148 size_t free;
149 } hdrs;
150 } curlbuf;
151 #endif
152 ZEND_END_MODULE_GLOBALS(http)
153
154 #endif /* PHP_HTTP_H */
155
156 /*
157 * Local variables:
158 * tab-width: 4
159 * c-basic-offset: 4
160 * End:
161 * vim600: noet sw=4 ts=4 fdm=marker
162 * vim<600: noet sw=4 ts=4
163 */
164