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-2007, Michael Wallner <mike@php.net> |
10 : +--------------------------------------------------------------------+
11 : */
12 :
13 : /* $Id: http_util_object.c,v 1.37 2007/02/07 11:50:27 mike Exp $ */
14 :
15 : #include "php_http.h"
16 :
17 : #ifdef ZEND_ENGINE_2
18 :
19 : #include "ext/standard/php_http.h"
20 :
21 : #include "php_http_util_object.h"
22 :
23 : #define HTTP_BEGIN_ARGS(method, req_args) HTTP_BEGIN_ARGS_EX(HttpUtil, method, 0, req_args)
24 : #define HTTP_EMPTY_ARGS(method) HTTP_EMPTY_ARGS_EX(HttpUtil, method, 0)
25 :
26 : #define HTTP_UTIL_ALIAS(method, func) HTTP_STATIC_ME_ALIAS(method, func, HTTP_ARGS(HttpUtil, method))
27 :
28 : HTTP_BEGIN_ARGS(date, 0)
29 : HTTP_ARG_VAL(timestamp, 0)
30 : HTTP_END_ARGS;
31 :
32 : HTTP_BEGIN_ARGS(buildStr, 1)
33 : HTTP_ARG_VAL(query, 0)
34 : HTTP_ARG_VAL(prefix, 0)
35 : HTTP_ARG_VAL(arg_sep, 0)
36 : HTTP_END_ARGS;
37 :
38 : HTTP_BEGIN_ARGS(buildUrl, 1)
39 : HTTP_ARG_VAL(url, 0)
40 : HTTP_ARG_VAL(parts, 0)
41 : HTTP_ARG_VAL(flags, 0)
42 : HTTP_ARG_VAL(composed, 1)
43 : HTTP_END_ARGS;
44 :
45 : HTTP_BEGIN_ARGS(negotiateLanguage, 1)
46 : HTTP_ARG_VAL(supported, 0)
47 : HTTP_ARG_VAL(result, 1)
48 : HTTP_END_ARGS;
49 :
50 : HTTP_BEGIN_ARGS(negotiateCharset, 1)
51 : HTTP_ARG_VAL(supported, 0)
52 : HTTP_ARG_VAL(result, 1)
53 : HTTP_END_ARGS;
54 :
55 : HTTP_BEGIN_ARGS(negotiateContentType, 1)
56 : HTTP_ARG_VAL(supported, 0)
57 : HTTP_ARG_VAL(result, 1)
58 : HTTP_END_ARGS;
59 :
60 : HTTP_BEGIN_ARGS(matchModified, 1)
61 : HTTP_ARG_VAL(last_modified, 0)
62 : HTTP_ARG_VAL(for_range, 0)
63 : HTTP_END_ARGS;
64 :
65 : HTTP_BEGIN_ARGS(matchEtag, 1)
66 : HTTP_ARG_VAL(plain_etag, 0)
67 : HTTP_ARG_VAL(for_range, 0)
68 : HTTP_END_ARGS;
69 :
70 : HTTP_BEGIN_ARGS(matchRequestHeader, 2)
71 : HTTP_ARG_VAL(header_name, 0)
72 : HTTP_ARG_VAL(header_value, 0)
73 : HTTP_ARG_VAL(case_sensitive, 0)
74 : HTTP_END_ARGS;
75 :
76 : HTTP_BEGIN_ARGS(parseMessage, 1)
77 : HTTP_ARG_VAL(message_string, 0)
78 : HTTP_END_ARGS;
79 :
80 : HTTP_BEGIN_ARGS(parseHeaders, 1)
81 : HTTP_ARG_VAL(headers_string, 0)
82 : HTTP_END_ARGS;
83 :
84 : HTTP_BEGIN_ARGS(parseCookie, 1)
85 : HTTP_ARG_VAL(cookie_string, 0)
86 : HTTP_END_ARGS;
87 :
88 : HTTP_BEGIN_ARGS(buildCookie, 1)
89 : HTTP_ARG_VAL(cookie_array, 0)
90 : HTTP_END_ARGS;
91 :
92 : HTTP_BEGIN_ARGS(parseParams, 1)
93 : HTTP_ARG_VAL(param_string, 0)
94 : HTTP_ARG_VAL(flags, 0)
95 : HTTP_END_ARGS;
96 :
97 : HTTP_BEGIN_ARGS(chunkedDecode, 1)
98 : HTTP_ARG_VAL(encoded_string, 0)
99 : HTTP_END_ARGS;
100 :
101 : #ifdef HTTP_HAVE_ZLIB
102 : HTTP_BEGIN_ARGS(deflate, 1)
103 : HTTP_ARG_VAL(plain, 0)
104 : HTTP_ARG_VAL(flags, 0)
105 : HTTP_END_ARGS;
106 :
107 : HTTP_BEGIN_ARGS(inflate, 1)
108 : HTTP_ARG_VAL(encoded, 0)
109 : HTTP_END_ARGS;
110 : #endif
111 :
112 : HTTP_BEGIN_ARGS(support, 0)
113 : HTTP_ARG_VAL(feature, 0)
114 : HTTP_END_ARGS;
115 :
116 : zend_class_entry *http_util_object_ce;
117 : zend_function_entry http_util_object_fe[] = {
118 : HTTP_UTIL_ALIAS(date, http_date)
119 : HTTP_UTIL_ALIAS(buildUrl, http_build_url)
120 : HTTP_UTIL_ALIAS(buildStr, http_build_str)
121 : HTTP_UTIL_ALIAS(negotiateLanguage, http_negotiate_language)
122 : HTTP_UTIL_ALIAS(negotiateCharset, http_negotiate_charset)
123 : HTTP_UTIL_ALIAS(negotiateContentType, http_negotiate_content_type)
124 : HTTP_UTIL_ALIAS(matchModified, http_match_modified)
125 : HTTP_UTIL_ALIAS(matchEtag, http_match_etag)
126 : HTTP_UTIL_ALIAS(matchRequestHeader, http_match_request_header)
127 : HTTP_UTIL_ALIAS(parseMessage, http_parse_message)
128 : HTTP_UTIL_ALIAS(parseHeaders, http_parse_headers)
129 : HTTP_UTIL_ALIAS(parseCookie, http_parse_cookie)
130 : HTTP_UTIL_ALIAS(buildCookie, http_build_cookie)
131 : HTTP_UTIL_ALIAS(parseParams, http_parse_params)
132 : HTTP_UTIL_ALIAS(chunkedDecode, http_chunked_decode)
133 : #ifdef HTTP_HAVE_ZLIB
134 : HTTP_UTIL_ALIAS(deflate, http_deflate)
135 : HTTP_UTIL_ALIAS(inflate, http_inflate)
136 : #endif /* HTTP_HAVE_ZLIB */
137 : HTTP_UTIL_ALIAS(support, http_support)
138 :
139 : EMPTY_FUNCTION_ENTRY
140 : };
141 :
142 : PHP_MINIT_FUNCTION(http_util_object)
143 220 : {
144 220 : HTTP_REGISTER_CLASS(HttpUtil, http_util_object, NULL, 0);
145 220 : return SUCCESS;
146 : }
147 :
148 : #endif /* ZEND_ENGINE_2 */
149 :
150 : /*
151 : * Local variables:
152 : * tab-width: 4
153 : * c-basic-offset: 4
154 : * End:
155 : * vim600: noet sw=4 ts=4 fdm=marker
156 : * vim<600: noet sw=4 ts=4
157 : */
158 :
|