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