2 +----------------------------------------------------------------------+
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 +----------------------------------------------------------------------+
25 # include <winsock2.h>
27 # include <curl/curl.h>
33 #include "ext/standard/info.h"
34 #include "ext/session/php_session.h"
35 #include "ext/standard/php_string.h"
36 #include "ext/standard/php_smart_str.h"
41 #include "php_http_std_defs.h"
42 #include "php_http_api.h"
43 #include "php_http_auth_api.h"
44 #include "php_http_curl_api.h"
45 #include "php_http_cache_api.h"
46 #include "php_http_curl_api.h"
47 #include "php_http_date_api.h"
48 #include "php_http_headers_api.h"
49 #include "php_http_message_api.h"
50 #include "php_http_send_api.h"
51 #include "php_http_url_api.h"
53 #include "phpstr/phpstr.h"
57 # ifdef ZEND_BEGIN_ARG_INFO
58 ZEND_BEGIN_ARG_INFO(http_request_info_ref_3
, 0)
64 ZEND_BEGIN_ARG_INFO(http_request_info_ref_4
, 0)
71 static unsigned char http_request_info_ref_3
[] = {3, BYREF_NONE
, BYREF_NONE
, BYREF_FORCE
};
72 static unsigned char http_request_info_ref_4
[] = {4, BYREF_NONE
, BYREF_NONE
, BYREF_NONE
, BYREF_FORCE
};
76 #endif /* HTTP_HAVE_CURL */
78 ZEND_DECLARE_MODULE_GLOBALS(http
)
80 #ifdef COMPILE_DL_HTTP
84 /* {{{ http_functions[] */
85 function_entry http_functions
[] = {
86 PHP_FE(http_test
, NULL
)
87 PHP_FE(http_date
, NULL
)
88 PHP_FE(http_absolute_uri
, NULL
)
89 PHP_FE(http_negotiate_language
, NULL
)
90 PHP_FE(http_negotiate_charset
, NULL
)
91 PHP_FE(http_redirect
, NULL
)
92 PHP_FE(http_send_status
, NULL
)
93 PHP_FE(http_send_last_modified
, NULL
)
94 PHP_FE(http_send_content_type
, NULL
)
95 PHP_FE(http_send_content_disposition
, NULL
)
96 PHP_FE(http_match_modified
, NULL
)
97 PHP_FE(http_match_etag
, NULL
)
98 PHP_FE(http_cache_last_modified
, NULL
)
99 PHP_FE(http_cache_etag
, NULL
)
100 PHP_FE(http_send_data
, NULL
)
101 PHP_FE(http_send_file
, NULL
)
102 PHP_FE(http_send_stream
, NULL
)
103 PHP_FE(http_chunked_decode
, NULL
)
104 PHP_FE(http_split_response
, NULL
)
105 PHP_FE(http_parse_headers
, NULL
)
106 PHP_FE(http_get_request_headers
, NULL
)
107 #ifdef HTTP_HAVE_CURL
108 PHP_FE(http_get
, http_request_info_ref_3
)
109 PHP_FE(http_head
, http_request_info_ref_3
)
110 PHP_FE(http_post_data
, http_request_info_ref_4
)
111 PHP_FE(http_post_array
, http_request_info_ref_4
)
113 PHP_FE(http_auth_basic
, NULL
)
114 PHP_FE(http_auth_basic_cb
, NULL
)
115 #ifndef ZEND_ENGINE_2
116 PHP_FE(http_build_query
, NULL
)
118 PHP_FE(ob_httpetaghandler
, NULL
)
128 zend_class_entry
*http_util_ce
;
130 #define HTTP_UTIL_ME(me, al, ai) ZEND_FENTRY(me, ZEND_FN(al), ai, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
132 zend_function_entry http_util_class_methods
[] = {
133 HTTP_UTIL_ME(date
, http_date
, NULL
)
134 HTTP_UTIL_ME(absoluteURI
, http_absolute_uri
, NULL
)
135 HTTP_UTIL_ME(negotiateLanguage
, http_negotiate_language
, NULL
)
136 HTTP_UTIL_ME(negotiateCharset
, http_negotiate_charset
, NULL
)
137 HTTP_UTIL_ME(redirect
, http_redirect
, NULL
)
138 HTTP_UTIL_ME(sendStatus
, http_send_status
, NULL
)
139 HTTP_UTIL_ME(sendLastModified
, http_send_last_modified
, NULL
)
140 HTTP_UTIL_ME(sendContentType
, http_send_content_type
, NULL
)
141 HTTP_UTIL_ME(sendContentDisposition
, http_send_content_disposition
, NULL
)
142 HTTP_UTIL_ME(matchModified
, http_match_modified
, NULL
)
143 HTTP_UTIL_ME(matchEtag
, http_match_etag
, NULL
)
144 HTTP_UTIL_ME(cacheLastModified
, http_cache_last_modified
, NULL
)
145 HTTP_UTIL_ME(cacheEtag
, http_cache_etag
, NULL
)
146 HTTP_UTIL_ME(chunkedDecode
, http_chunked_decode
, NULL
)
147 HTTP_UTIL_ME(splitResponse
, http_split_response
, NULL
)
148 HTTP_UTIL_ME(parseHeaders
, http_parse_headers
, NULL
)
149 HTTP_UTIL_ME(getRequestHeaders
, http_get_request_headers
, NULL
)
150 #ifdef HTTP_HAVE_CURL
151 HTTP_UTIL_ME(get
, http_get
, http_request_info_ref_3
)
152 HTTP_UTIL_ME(head
, http_head
, http_request_info_ref_3
)
153 HTTP_UTIL_ME(postData
, http_post_data
, http_request_info_ref_4
)
154 HTTP_UTIL_ME(postArray
, http_post_array
, http_request_info_ref_4
)
156 HTTP_UTIL_ME(authBasic
, http_auth_basic
, NULL
)
157 HTTP_UTIL_ME(authBasicCallback
, http_auth_basic_cb
, NULL
)
162 /* {{{ HttpResponse */
164 zend_class_entry
*http_response_ce
;
165 static zend_object_handlers http_response_object_handlers
;
167 #define http_response_declare_default_properties(ce) _http_response_declare_default_properties(ce TSRMLS_CC)
168 static inline void _http_response_declare_default_properties(zend_class_entry
*ce TSRMLS_DC
)
170 DCL_PROP(PROTECTED
, string
, contentType
, "application/x-octetstream");
171 DCL_PROP(PROTECTED
, string
, eTag
, "");
172 DCL_PROP(PROTECTED
, string
, dispoFile
, "");
173 DCL_PROP(PROTECTED
, string
, cacheControl
, "public");
174 DCL_PROP(PROTECTED
, string
, data
, "");
175 DCL_PROP(PROTECTED
, string
, file
, "");
176 DCL_PROP(PROTECTED
, long, stream
, 0);
177 DCL_PROP(PROTECTED
, long, lastModified
, 0);
178 DCL_PROP(PROTECTED
, long, dispoInline
, 0);
179 DCL_PROP(PROTECTED
, long, cache
, 0);
180 DCL_PROP(PROTECTED
, long, gzip
, 0);
182 DCL_PROP(PRIVATE
, long, raw_cache_header
, 0);
183 DCL_PROP(PRIVATE
, long, send_mode
, -1);
186 #define http_response_destroy_object _http_response_destroy_object
187 void _http_response_destroy_object(void *object
, zend_object_handle handle TSRMLS_DC
)
189 http_response_object
*o
= object
;
191 zend_hash_destroy(OBJ_PROP(o
));
192 FREE_HASHTABLE(OBJ_PROP(o
));
197 #define http_response_new_object _http_response_new_object
198 zend_object_value
_http_response_new_object(zend_class_entry
*ce TSRMLS_DC
)
200 zend_object_value ov
;
201 http_response_object
*o
;
203 o
= ecalloc(1, sizeof(http_response_object
));
206 ALLOC_HASHTABLE(OBJ_PROP(o
));
207 zend_hash_init(OBJ_PROP(o
), 0, NULL
, ZVAL_PTR_DTOR
, 0);
208 zend_hash_copy(OBJ_PROP(o
), &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
, NULL
, sizeof(zval
*));
210 ov
.handle
= zend_objects_store_put(o
, http_response_destroy_object
, NULL
, NULL TSRMLS_CC
);
211 ov
.handlers
= &http_response_object_handlers
;
216 zend_function_entry http_response_class_methods
[] = {
217 PHP_ME(HttpResponse
, __construct
, NULL
, ZEND_ACC_PUBLIC
|ZEND_ACC_CTOR
)
218 /* PHP_ME(HttpResponse, __destruct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR)
220 PHP_ME(HttpResponse
, setETag
, NULL
, ZEND_ACC_PUBLIC
)
221 PHP_ME(HttpResponse
, getETag
, NULL
, ZEND_ACC_PUBLIC
)
223 PHP_ME(HttpResponse
, setContentDisposition
, NULL
, ZEND_ACC_PUBLIC
)
224 PHP_ME(HttpResponse
, getContentDisposition
, NULL
, ZEND_ACC_PUBLIC
)
226 PHP_ME(HttpResponse
, setContentType
, NULL
, ZEND_ACC_PUBLIC
)
227 PHP_ME(HttpResponse
, getContentType
, NULL
, ZEND_ACC_PUBLIC
)
229 PHP_ME(HttpResponse
, setCache
, NULL
, ZEND_ACC_PUBLIC
)
230 PHP_ME(HttpResponse
, getCache
, NULL
, ZEND_ACC_PUBLIC
)
232 PHP_ME(HttpResponse
, setCacheControl
, NULL
, ZEND_ACC_PUBLIC
)
233 PHP_ME(HttpResponse
, getCacheControl
, NULL
, ZEND_ACC_PUBLIC
)
235 PHP_ME(HttpResponse
, setGzip
, NULL
, ZEND_ACC_PUBLIC
)
236 PHP_ME(HttpResponse
, getGzip
, NULL
, ZEND_ACC_PUBLIC
)
238 PHP_ME(HttpResponse
, setData
, NULL
, ZEND_ACC_PUBLIC
)
239 PHP_ME(HttpResponse
, getData
, NULL
, ZEND_ACC_PUBLIC
)
241 PHP_ME(HttpResponse
, setFile
, NULL
, ZEND_ACC_PUBLIC
)
242 PHP_ME(HttpResponse
, getFile
, NULL
, ZEND_ACC_PUBLIC
)
244 PHP_ME(HttpResponse
, setStream
, NULL
, ZEND_ACC_PUBLIC
)
245 PHP_ME(HttpResponse
, getStream
, NULL
, ZEND_ACC_PUBLIC
)
247 PHP_ME(HttpResponse
, send
, NULL
, ZEND_ACC_PUBLIC
)
253 /* {{{ HttpRequest */
254 #ifdef HTTP_HAVE_CURL
256 zend_class_entry
*http_request_ce
;
257 static zend_object_handlers http_request_object_handlers
;
259 #define http_request_declare_default_properties(ce) _http_request_declare_default_properties(ce TSRMLS_CC)
260 static inline void _http_request_declare_default_properties(zend_class_entry
*ce TSRMLS_DC
)
262 DCL_PROP_N(PROTECTED
, options
);
263 DCL_PROP_N(PROTECTED
, responseInfo
);
264 DCL_PROP_N(PROTECTED
, responseData
);
265 DCL_PROP_N(PROTECTED
, postData
);
266 DCL_PROP_N(PROTECTED
, postFiles
);
268 DCL_PROP(PROTECTED
, long, method
, HTTP_GET
);
270 DCL_PROP(PROTECTED
, string
, url
, "");
271 DCL_PROP(PROTECTED
, string
, contentType
, "");
272 DCL_PROP(PROTECTED
, string
, queryData
, "");
273 DCL_PROP(PROTECTED
, string
, postData
, "");
276 #define http_request_free_object _http_request_free_object
277 void _http_request_free_object(zend_object
/* void */ *object TSRMLS_DC
)
279 http_request_object
*o
= (http_request_object
*) object
;
282 zend_hash_destroy(OBJ_PROP(o
));
283 FREE_HASHTABLE(OBJ_PROP(o
));
286 curl_easy_cleanup(o
->ch
);
292 #define http_request_new_object _http_request_new_object
293 zend_object_value
_http_request_new_object(zend_class_entry
*ce TSRMLS_DC
)
295 zend_object_value ov
;
296 http_request_object
*o
;
298 o
= ecalloc(1, sizeof(http_request_object
));
300 o
->ch
= curl_easy_init();
302 ALLOC_HASHTABLE(OBJ_PROP(o
));
303 zend_hash_init(OBJ_PROP(o
), 0, NULL
, ZVAL_PTR_DTOR
, 0);
304 zend_hash_copy(OBJ_PROP(o
), &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
, NULL
, sizeof(zval
*));
306 ov
.handle
= zend_objects_store_put(o
, (zend_objects_store_dtor_t
) zend_objects_destroy_object
, http_request_free_object
, NULL TSRMLS_CC
);
307 ov
.handlers
= &http_request_object_handlers
;
312 zend_function_entry http_request_class_methods
[] = {
313 PHP_ME(HttpRequest
, __construct
, NULL
, ZEND_ACC_PUBLIC
|ZEND_ACC_CTOR
)
314 PHP_ME(HttpRequest
, __destruct
, NULL
, ZEND_ACC_PUBLIC
|ZEND_ACC_DTOR
)
316 PHP_ME(HttpRequest
, setOptions
, NULL
, ZEND_ACC_PUBLIC
)
317 PHP_ME(HttpRequest
, getOptions
, NULL
, ZEND_ACC_PUBLIC
)
318 PHP_ME(HttpRequest
, unsetOptions
, NULL
, ZEND_ACC_PUBLIC
)
319 PHP_ME(HttpRequest
, setSslOptions
, NULL
, ZEND_ACC_PUBLIC
)
320 PHP_ME(HttpRequest
, getSslOptions
, NULL
, ZEND_ACC_PUBLIC
)
321 PHP_ME(HttpRequest
, unsetSslOptions
, NULL
, ZEND_ACC_PUBLIC
)
323 PHP_ME(HttpRequest
, addHeaders
, NULL
, ZEND_ACC_PUBLIC
)
324 PHP_ME(HttpRequest
, getHeaders
, NULL
, ZEND_ACC_PUBLIC
)
325 PHP_ME(HttpRequest
, unsetHeaders
, NULL
, ZEND_ACC_PUBLIC
)
326 PHP_ME(HttpRequest
, addCookies
, NULL
, ZEND_ACC_PUBLIC
)
327 PHP_ME(HttpRequest
, getCookies
, NULL
, ZEND_ACC_PUBLIC
)
328 PHP_ME(HttpRequest
, unsetCookies
, NULL
, ZEND_ACC_PUBLIC
)
330 PHP_ME(HttpRequest
, setMethod
, NULL
, ZEND_ACC_PUBLIC
)
331 PHP_ME(HttpRequest
, getMethod
, NULL
, ZEND_ACC_PUBLIC
)
333 PHP_ME(HttpRequest
, setURL
, NULL
, ZEND_ACC_PUBLIC
)
334 PHP_ME(HttpRequest
, getURL
, NULL
, ZEND_ACC_PUBLIC
)
336 PHP_ME(HttpRequest
, setContentType
, NULL
, ZEND_ACC_PUBLIC
)
337 PHP_ME(HttpRequest
, getContentType
, NULL
, ZEND_ACC_PUBLIC
)
339 PHP_ME(HttpRequest
, setQueryData
, NULL
, ZEND_ACC_PUBLIC
)
340 PHP_ME(HttpRequest
, getQueryData
, NULL
, ZEND_ACC_PUBLIC
)
341 PHP_ME(HttpRequest
, addQueryData
, NULL
, ZEND_ACC_PUBLIC
)
342 PHP_ME(HttpRequest
, unsetQueryData
, NULL
, ZEND_ACC_PUBLIC
)
344 PHP_ME(HttpRequest
, setPostData
, NULL
, ZEND_ACC_PUBLIC
)
345 PHP_ME(HttpRequest
, getPostData
, NULL
, ZEND_ACC_PUBLIC
)
346 PHP_ME(HttpRequest
, addPostData
, NULL
, ZEND_ACC_PUBLIC
)
347 PHP_ME(HttpRequest
, unsetPostData
, NULL
, ZEND_ACC_PUBLIC
)
349 PHP_ME(HttpRequest
, addPostFile
, NULL
, ZEND_ACC_PUBLIC
)
350 PHP_ME(HttpRequest
, getPostFiles
, NULL
, ZEND_ACC_PUBLIC
)
351 PHP_ME(HttpRequest
, unsetPostFiles
, NULL
, ZEND_ACC_PUBLIC
)
353 PHP_ME(HttpRequest
, send
, NULL
, ZEND_ACC_PUBLIC
)
355 PHP_ME(HttpRequest
, getResponseData
, NULL
, ZEND_ACC_PUBLIC
)
356 PHP_ME(HttpRequest
, getResponseHeader
, NULL
, ZEND_ACC_PUBLIC
)
357 PHP_ME(HttpRequest
, getResponseCookie
, NULL
, ZEND_ACC_PUBLIC
)
358 PHP_ME(HttpRequest
, getResponseCode
, NULL
, ZEND_ACC_PUBLIC
)
359 PHP_ME(HttpRequest
, getResponseBody
, NULL
, ZEND_ACC_PUBLIC
)
360 PHP_ME(HttpRequest
, getResponseInfo
, NULL
, ZEND_ACC_PUBLIC
)
365 #endif /* HTTP_HAVE_CURL */
368 #endif /* ZEND_ENGINE_2 */
370 /* {{{ http_module_entry */
371 zend_module_entry http_module_entry
= {
372 #if ZEND_MODULE_API_NO >= 20010901
373 STANDARD_MODULE_HEADER
,
382 #if ZEND_MODULE_API_NO >= 20010901
385 STANDARD_MODULE_PROPERTIES
390 static void free_to_free(void *s
)
395 /* {{{ php_http_init_globals(zend_http_globals *) */
396 static void php_http_init_globals(zend_http_globals
*http_globals
)
398 http_globals
->etag_started
= 0;
399 http_globals
->ctype
= NULL
;
400 http_globals
->etag
= NULL
;
401 http_globals
->lmod
= 0;
402 #ifdef HTTP_HAVE_CURL
403 phpstr_init_ex(&http_globals
->curlbuf
, HTTP_CURLBUF_SIZE
, 0);
404 # if LIBCURL_VERSION_NUM < 0x070c00
405 memset(&http_globals
->curlerr
, 0, sizeof(http_globals
->curlerr
));
407 zend_llist_init(&http_globals
->to_free
, sizeof(char *), free_to_free
, 0);
409 http_globals
->allowed_methods
= NULL
;
413 /* {{{ static inline STATUS http_check_allowed_methods(char *, int) */
414 #define http_check_allowed_methods(m, l) _http_check_allowed_methods((m), (l) TSRMLS_CC)
415 static inline void _http_check_allowed_methods(char *methods
, int length TSRMLS_DC
)
417 if (length
&& SG(request_info
).request_method
&& (!strstr(methods
, SG(request_info
).request_method
))) {
418 char *allow_header
= emalloc(length
+ sizeof("Allow: "));
419 sprintf(allow_header
, "Allow: %s", methods
);
420 http_send_header(allow_header
);
422 http_send_status(405);
429 PHP_INI_MH(update_allowed_methods
)
431 http_check_allowed_methods(new_value
, new_value_length
);
432 return OnUpdateString(entry
, new_value
, new_value_length
, mh_arg1
, mh_arg2
, mh_arg3
, stage TSRMLS_CC
);
436 STD_PHP_INI_ENTRY("http.allowed_methods",
438 "GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT, "
439 /* WebDAV - RFC 2518 * /
440 "PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, "
441 /* WebDAV Versioning - RFC 3253 * /
442 "VERSION-CONTROL, REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, "
443 "MKWORKSPACE, UPDATE, LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, "
444 /* WebDAV Access Control - RFC 3744 * /
448 PHP_INI_ALL
, update_allowed_methods
, allowed_methods
, zend_http_globals
, http_globals
)
452 /* {{{ HTTP_CURL_USE_ZEND_MM */
453 #if defined(HTTP_HAVE_CURL) && defined(HTTP_CURL_USE_ZEND_MM)
454 static void http_curl_free(void *p
) { efree(p
); }
455 static char *http_curl_strdup(const char *p
) { return estrdup(p
); }
456 static void *http_curl_malloc(size_t s
) { return emalloc(s
); }
457 static void *http_curl_realloc(void *p
, size_t s
) { return erealloc(p
, s
); }
458 static void *http_curl_calloc(size_t n
, size_t s
) { return ecalloc(n
, s
); }
459 #endif /* HTTP_HAVE_CURL && HTTP_CURL_USE_ZEND_MM */
462 /* {{{ PHP_MINIT_FUNCTION */
463 PHP_MINIT_FUNCTION(http
)
465 ZEND_INIT_MODULE_GLOBALS(http
, php_http_init_globals
, NULL
);
466 REGISTER_INI_ENTRIES();
468 #ifdef HTTP_HAVE_CURL
469 # ifdef HTTP_CURL_USE_ZEND_MM
470 if (CURLE_OK
!= curl_global_init_mem(CURL_GLOBAL_ALL
,
478 # endif /* HTTP_CURL_USE_ZEND_MM */
480 # if LIBCURL_VERSION_NUM >= 0x070a05
481 REGISTER_LONG_CONSTANT("HTTP_AUTH_BASIC", CURLAUTH_BASIC
, CONST_CS
| CONST_PERSISTENT
);
482 REGISTER_LONG_CONSTANT("HTTP_AUTH_DIGEST", CURLAUTH_DIGEST
, CONST_CS
| CONST_PERSISTENT
);
483 REGISTER_LONG_CONSTANT("HTTP_AUTH_NTLM", CURLAUTH_NTLM
, CONST_CS
| CONST_PERSISTENT
);
484 # endif /* LIBCURL_VERSION_NUM */
485 #endif /* HTTP_HAVE_CURL */
488 HTTP_REGISTER_CLASS(HttpUtil
, http_util
, NULL
, ZEND_ACC_FINAL_CLASS
);
489 HTTP_REGISTER_CLASS_EX(HttpResponse
, http_response
, NULL
, 0);
490 # ifdef HTTP_HAVE_CURL
491 HTTP_REGISTER_CLASS_EX(HttpRequest
, http_request
, NULL
, 0);
493 REGISTER_LONG_CONSTANT("HTTP_GET", HTTP_GET
, CONST_CS
| CONST_PERSISTENT
);
494 REGISTER_LONG_CONSTANT("HTTP_HEAD", HTTP_HEAD
, CONST_CS
| CONST_PERSISTENT
);
495 REGISTER_LONG_CONSTANT("HTTP_POST", HTTP_POST
, CONST_CS
| CONST_PERSISTENT
);
496 # endif /* HTTP_HAVE_CURL */
497 #endif /* ZEND_ENGINE_2 */
502 /* {{{ PHP_MSHUTDOWN_FUNCTION */
503 PHP_MSHUTDOWN_FUNCTION(http
)
505 UNREGISTER_INI_ENTRIES();
506 #ifdef HTTP_HAVE_CURL
507 phpstr_dtor(&HTTP_G(curlbuf
));
508 curl_global_cleanup();
514 /* {{{ PHP_RINIT_FUNCTION */
515 PHP_RINIT_FUNCTION(http
)
517 char *allowed_methods
= INI_STR("http.allowed_methods");
518 http_check_allowed_methods(allowed_methods
, strlen(allowed_methods
));
523 /* {{{ PHP_RSHUTDOWN_FUNCTION */
524 PHP_RSHUTDOWN_FUNCTION(http
)
526 HTTP_G(etag_started
) = 0;
535 efree(HTTP_G(ctype
));
536 HTTP_G(ctype
) = NULL
;
539 #ifdef HTTP_HAVE_CURL
540 # if LIBCURL_VERSION_NUM < 0x070c00
541 memset(&HTTP_G(curlerr
), 0, sizeof(HTTP_G(curlerr
)));
543 phpstr_dtor(&HTTP_G(curlbuf
));
550 /* {{{ PHP_MINFO_FUNCTION */
551 PHP_MINFO_FUNCTION(http
)
554 # define HTTP_FUNC_AVAIL(CLASS) "procedural, object oriented (class " CLASS ")"
556 # define HTTP_FUNC_AVAIL(CLASS) "procedural"
559 #ifdef HTTP_HAVE_CURL
560 # define HTTP_CURL_VERSION curl_version()
561 # ifdef ZEND_ENGINE_2
562 # define HTTP_CURL_AVAIL(CLASS) "procedural, object oriented (class " CLASS ")"
564 # define HTTP_CURL_AVAIL(CLASS) "procedural"
567 # define HTTP_CURL_VERSION "libcurl not available"
568 # define HTTP_CURL_AVAIL(CLASS) "libcurl not available"
571 char full_version_string
[1024] = {0};
572 snprintf(full_version_string
, 1023, "%s (%s)", HTTP_PEXT_VERSION
, HTTP_CURL_VERSION
);
574 php_info_print_table_start();
575 php_info_print_table_row(2, "Extended HTTP support", "enabled");
576 php_info_print_table_row(2, "Extension Version:", full_version_string
);
577 php_info_print_table_end();
579 php_info_print_table_start();
580 php_info_print_table_header(2, "Functionality", "Availability");
581 php_info_print_table_row(2, "Miscellaneous Utilities:", HTTP_FUNC_AVAIL("HttpUtil"));
582 php_info_print_table_row(2, "Extended HTTP Responses:", HTTP_FUNC_AVAIL("HttpResponse"));
583 php_info_print_table_row(2, "Extended HTTP Requests:", HTTP_CURL_AVAIL("HttpRequest"));
584 php_info_print_table_end();
586 DISPLAY_INI_ENTRIES();
595 * vim600: noet sw=4 ts=4 fdm=marker
596 * vim<600: noet sw=4 ts=4