- fix http_get_request_body()
[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 #include "php.h"
21 #include "php_http_std_defs.h"
22 #include "phpstr/phpstr.h"
23 #include "missing.h"
24
25 #ifdef HTTP_WANT_NETDB
26 # ifdef PHP_WIN32
27 # define HTTP_HAVE_NETDB
28 # include <winsock2.h>
29 # elif defined(HAVE_NETDB_H)
30 # define HTTP_HAVE_NETDB
31 # include <netdb.h>
32 # endif
33 #endif
34
35 #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL)
36 # ifdef PHP_WIN32
37 # include <winsock2.h>
38 # define CURL_STATICLIB
39 # endif
40 # include <curl/curl.h>
41 #endif
42
43 #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC)
44 # if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC)
45 # define USE_MAGIC_STATIC
46 # endif
47 # include <magic.h>
48 #endif
49
50 #if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB)
51 # include <zlib.h>
52 #endif
53
54 #include <ctype.h>
55
56 extern zend_module_entry http_module_entry;
57 #define phpext_http_ptr &http_module_entry
58
59 extern int http_module_number;
60
61 ZEND_BEGIN_MODULE_GLOBALS(http)
62
63 struct _http_globals_etag {
64 char *mode;
65 void *ctx;
66 zend_bool started;
67 } etag;
68
69 struct _http_globals_log {
70 char *cache;
71 char *redirect;
72 char *allowed_methods;
73 char *composite;
74 } log;
75
76 struct _http_globals_send {
77 double throttle_delay;
78 size_t buffer_size;
79 char *content_type;
80 char *unquoted_etag;
81 time_t last_modified;
82 struct _http_globals_send_deflate {
83 zend_bool start_auto;
84 long start_flags;
85 int encoding;
86 void *stream;
87 } deflate;
88 struct _http_globals_send_inflate {
89 zend_bool start_auto;
90 long start_flags;
91 void *stream;
92 } inflate;
93 } send;
94
95 struct _http_globals_request {
96 struct _http_globals_request_methods {
97 char *allowed;
98 struct _http_globals_request_methods_custom {
99 int count;
100 void *entries;
101 } custom;
102 } methods;
103 } request;
104
105 #ifdef ZEND_ENGINE_2
106 zend_bool only_exceptions;
107 #endif
108
109 zend_bool force_exit;
110 zend_bool read_post_data;
111
112 ZEND_END_MODULE_GLOBALS(http)
113
114 ZEND_EXTERN_MODULE_GLOBALS(http);
115
116 #ifdef ZTS
117 # include "TSRM.h"
118 # define HTTP_G(v) TSRMG(http_globals_id, zend_http_globals *, v)
119 # define HTTP_GLOBALS ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)])
120 #else
121 # define HTTP_G(v) (http_globals.v)
122 # define HTTP_GLOBALS (&http_globals)
123 #endif
124 #define getGlobals(G) zend_http_globals *G = HTTP_GLOBALS
125
126 PHP_FUNCTION(http_test);
127 PHP_FUNCTION(http_date);
128 PHP_FUNCTION(http_build_url);
129 PHP_FUNCTION(http_negotiate_language);
130 PHP_FUNCTION(http_negotiate_charset);
131 PHP_FUNCTION(http_negotiate_content_type);
132 PHP_FUNCTION(http_redirect);
133 PHP_FUNCTION(http_throttle);
134 PHP_FUNCTION(http_send_status);
135 PHP_FUNCTION(http_send_last_modified);
136 PHP_FUNCTION(http_send_content_type);
137 PHP_FUNCTION(http_send_content_disposition);
138 PHP_FUNCTION(http_match_modified);
139 PHP_FUNCTION(http_match_etag);
140 PHP_FUNCTION(http_cache_last_modified);
141 PHP_FUNCTION(http_cache_etag);
142 PHP_FUNCTION(http_send_data);
143 PHP_FUNCTION(http_send_file);
144 PHP_FUNCTION(http_send_stream);
145 PHP_FUNCTION(http_chunked_decode);
146 PHP_FUNCTION(http_parse_message);
147 PHP_FUNCTION(http_parse_headers);
148 PHP_FUNCTION(http_parse_cookie);
149 PHP_FUNCTION(http_get_request_headers);
150 PHP_FUNCTION(http_get_request_body);
151 PHP_FUNCTION(http_get_request_body_stream);
152 PHP_FUNCTION(http_match_request_header);
153 #ifdef HTTP_HAVE_CURL
154 PHP_FUNCTION(http_get);
155 PHP_FUNCTION(http_head);
156 PHP_FUNCTION(http_post_data);
157 PHP_FUNCTION(http_post_fields);
158 PHP_FUNCTION(http_put_file);
159 PHP_FUNCTION(http_put_stream);
160 #endif /* HTTP_HAVE_CURL */
161 PHP_FUNCTION(http_request_method_register);
162 PHP_FUNCTION(http_request_method_unregister);
163 PHP_FUNCTION(http_request_method_exists);
164 PHP_FUNCTION(http_request_method_name);
165 #ifndef ZEND_ENGINE_2
166 PHP_FUNCTION(http_build_query);
167 #endif /* ZEND_ENGINE_2 */
168 PHP_FUNCTION(ob_etaghandler);
169 #ifdef HTTP_HAVE_ZLIB
170 PHP_FUNCTION(http_deflate);
171 PHP_FUNCTION(http_inflate);
172 PHP_FUNCTION(ob_deflatehandler);
173 PHP_FUNCTION(ob_inflatehandler);
174 #endif
175 PHP_FUNCTION(http_support);
176
177 PHP_MINIT_FUNCTION(http);
178 PHP_MSHUTDOWN_FUNCTION(http);
179 PHP_RINIT_FUNCTION(http);
180 PHP_RSHUTDOWN_FUNCTION(http);
181 PHP_MINFO_FUNCTION(http);
182
183 #endif /* PHP_HTTP_H */
184
185 /*
186 * Local variables:
187 * tab-width: 4
188 * c-basic-offset: 4
189 * End:
190 * vim600: noet sw=4 ts=4 fdm=marker
191 * vim<600: noet sw=4 ts=4
192 */
193