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