From: Michael Wallner Date: Tue, 22 Nov 2005 16:34:59 +0000 (+0000) Subject: - module/includes cleanup X-Git-Tag: RELEASE_0_19_0~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=edc84b40eb2c5be04492fa98fec5833a030782eb;p=m6w6%2Fext-http - module/includes cleanup --- diff --git a/config.m4 b/config.m4 index 7176d2b..3b3dfdd 100644 --- a/config.m4 +++ b/config.m4 @@ -205,7 +205,7 @@ dnl ---- PHP_HTTP_HEADERS="php_http_std_defs.h php_http.h php_http_api.h php_http_cache_api.h \ php_http_date_api.h php_http_headers_api.h php_http_info_api.h php_http_message_api.h \ php_http_request_api.h php_http_request_method_api.h php_http_send_api.h php_http_url_api.h \ - php_http_encoding_api.h phpstr/phpstr.h" + php_http_encoding_api.h phpstr/phpstr.h missing.h" ifdef([PHP_INSTALL_HEADERS], [ PHP_INSTALL_HEADERS(ext/http, $PHP_HTTP_HEADERS) diff --git a/http.c b/http.c index 1c4a6a4..0a75157 100644 --- a/http.c +++ b/http.c @@ -12,24 +12,25 @@ /* $Id$ */ - #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" -#include "zend_extensions.h" +#define HTTP_WANT_CURL +#define HTTP_WANT_ZLIB +#define HTTP_WANT_MAGIC +#include "php_http.h" #include "SAPI.h" #include "php_ini.h" #include "ext/standard/info.h" +#include "zend_extensions.h" -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" #include "php_http_send_api.h" #include "php_http_cache_api.h" #include "php_http_headers_api.h" +#include "php_http_message_api.h" #include "php_http_request_method_api.h" #ifdef HTTP_HAVE_CURL # include "php_http_request_api.h" @@ -49,20 +50,6 @@ # include "php_http_exception_object.h" #endif -#include "missing.h" -#include "phpstr/phpstr.h" - -#ifdef HTTP_HAVE_CURL -# ifdef PHP_WIN32 -# include -# endif -# include -#endif -#ifdef HTTP_HAVE_ZLIB -# include -#endif - -#include ZEND_DECLARE_MODULE_GLOBALS(http); HTTP_DECLARE_ARG_PASS_INFO(); @@ -134,6 +121,9 @@ zend_function_entry http_functions[] = { static zend_module_dep http_module_dep[] = { # ifdef HAVE_SPL ZEND_MOD_REQUIRED("spl") +# endif +# ifdef HTTP_HAVE_EXT_HASH + ZEND_MOD_REQUIRED("hash") # endif {NULL, NULL, NULL, 0} }; @@ -155,7 +145,7 @@ zend_module_entry http_module_entry = { PHP_RINIT(http), PHP_RSHUTDOWN(http), PHP_MINFO(http), - HTTP_PEXT_VERSION, + PHP_EXT_HTTP_VERSION, STANDARD_MODULE_PROPERTIES }; /* }}} */ @@ -315,7 +305,7 @@ PHP_MINFO_FUNCTION(http) php_info_print_table_start(); { php_info_print_table_row(2, "Extended HTTP support", "enabled"); - php_info_print_table_row(2, "Extension Version", HTTP_PEXT_VERSION); + php_info_print_table_row(2, "Extension Version", PHP_EXT_HTTP_VERSION); #ifdef HTTP_HAVE_CURL php_info_print_table_row(2, "cURL HTTP Requests", curl_version()); #else diff --git a/http_api.c b/http_api.c index a392801..0bb6cf2 100644 --- a/http_api.c +++ b/http_api.c @@ -15,33 +15,21 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#include "php_http.h" #include "SAPI.h" +#include "php_output.h" #include "ext/standard/url.h" #include "ext/standard/head.h" -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" -#include "php_http_headers_api.h" -#include "php_http_request_api.h" #include "php_http_send_api.h" #ifdef ZEND_ENGINE_2 -# include "zend_exceptions.h" # include "php_http_exception_object.h" #endif -#include - -#ifdef HTTP_HAVE_MAGIC -# if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC) -# define USE_MAGIC_STATIC -# endif -# include -#endif - ZEND_EXTERN_MODULE_GLOBALS(http); PHP_MINIT_FUNCTION(http_support) @@ -337,63 +325,6 @@ PHP_HTTP_API STATUS _http_get_request_body_ex(char **body, size_t *length, zend_ /* }}} */ -/* {{{ char *http_guess_content_type(char *magic_file, long magic_mode, void *data, size_t size, http_send_mode mode) */ -PHP_HTTP_API char *_http_guess_content_type(const char *magicfile, long magicmode, void *data_ptr, size_t data_len, http_send_mode data_mode TSRMLS_DC) -{ - char *ct = NULL; - -#ifdef HTTP_HAVE_MAGIC - /* magic_load() fails if MAGIC_MIME is set because it - cowardly adds .mime to the file name */ - struct magic_set *magic = magic_open(magicmode &~ MAGIC_MIME); - - if (!magic) { - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid magic mode: %ld", magicmode); - } else if (-1 == magic_load(magic, magicfile)) { - http_error_ex(HE_WARNING, HTTP_E_RUNTIME, "Failed to load magic database '%s' (%s)", magicfile, magic_error(magic)); - } else { - const char *ctype = NULL; - - magic_setflags(magic, magicmode); - - switch (data_mode) - { - case SEND_RSRC: - { - char *buffer; - size_t b_len; - - b_len = php_stream_copy_to_mem(data_ptr, &buffer, 65536, 0); - ctype = magic_buffer(magic, buffer, b_len); - efree(buffer); - } - break; - - case SEND_DATA: - ctype = magic_buffer(magic, data_ptr, data_len); - break; - - default: - ctype = magic_file(magic, data_ptr); - break; - } - - if (ctype) { - ct = estrdup(ctype); - } else { - http_error_ex(HE_WARNING, HTTP_E_RUNTIME, "Failed to guess Content-Type: %s", magic_error(magic)); - } - } - if (magic) { - magic_close(magic); - } -#else - http_error(HE_WARNING, HTTP_E_RUNTIME, "Cannot guess Content-Type; libmagic not available"); -#endif - - return ct; -} -/* }}} */ /* * Local variables: * tab-width: 4 diff --git a/http_cache_api.c b/http_cache_api.c index dab5552..f8d1bf0 100644 --- a/http_cache_api.c +++ b/http_cache_api.c @@ -15,18 +15,17 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#include "php_http.h" #include "SAPI.h" -#include "php_streams.h" #include "php_output.h" +#include "php_streams.h" -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" #include "php_http_cache_api.h" -#include "php_http_send_api.h" #include "php_http_date_api.h" +#include "php_http_send_api.h" ZEND_EXTERN_MODULE_GLOBALS(http); diff --git a/http_date_api.c b/http_date_api.c index 3872009..91c1676 100644 --- a/http_date_api.c +++ b/http_date_api.c @@ -15,12 +15,9 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" #include "php_http.h" -#include "php_http_std_defs.h" - -#include +#include "php_http_date_api.h" static int check_day(char *day, size_t len); static int check_month(char *month); diff --git a/http_encoding_api.c b/http_encoding_api.c index 9475a17..7b726c8 100644 --- a/http_encoding_api.c +++ b/http_encoding_api.c @@ -15,17 +15,12 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" - -#include "php_http_encoding_api.h" #include "php_http.h" -#include "php_http_api.h" -#ifdef HTTP_HAVE_ZLIB -# include "php_http_send_api.h" -# include "php_http_headers_api.h" -# include -#endif +#include "php_http_api.h" +#include "php_http_encoding_api.h" +#include "php_http_send_api.h" +#include "php_http_headers_api.h" ZEND_EXTERN_MODULE_GLOBALS(http); diff --git a/http_exception_object.c b/http_exception_object.c index 3fc2bc9..b6594ba 100644 --- a/http_exception_object.c +++ b/http_exception_object.c @@ -16,14 +16,11 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" -#ifdef ZEND_ENGINE_2 +#include "php_http.h" -#include "zend_exceptions.h" +#ifdef ZEND_ENGINE_2 -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_exception_object.h" #define HTTP_EX_DEF_CE http_exception_object_ce diff --git a/http_filter_api.c b/http_filter_api.c index fb44f02..444e3d0 100644 --- a/http_filter_api.c +++ b/http_filter_api.c @@ -15,18 +15,15 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#include "php_http.h" #ifdef ZEND_ENGINE_2 -#include "php_http_std_defs.h" +#include "php_streams.h" #include "php_http_api.h" #include "php_http_filter_api.h" -#include "phpstr/phpstr.h" - -#include "php_streams.h" - PHP_MINIT_FUNCTION(http_filter) { php_stream_filter_register_factory("http.*", &http_filter_factory TSRMLS_CC); diff --git a/http_functions.c b/http_functions.c index aa49518..c094e64 100644 --- a/http_functions.c +++ b/http_functions.c @@ -15,33 +15,30 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" -#include "zend_operators.h" +#define HTTP_WANT_CURL +#include "php_http.h" #include "SAPI.h" #include "php_ini.h" #include "ext/standard/info.h" #include "ext/standard/php_string.h" +#include "zend_operators.h" + #if defined(HAVE_PHP_SESSION) && !defined(COMPILE_DL_SESSION) # include "ext/session/php_session.h" #endif -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" -#include "php_http_request_api.h" #include "php_http_cache_api.h" -#include "php_http_request_method_api.h" -#include "php_http_request_api.h" #include "php_http_date_api.h" +#include "php_http_encoding_api.h" #include "php_http_headers_api.h" #include "php_http_message_api.h" +#include "php_http_request_api.h" +#include "php_http_request_method_api.h" #include "php_http_send_api.h" #include "php_http_url_api.h" -#include "php_http_encoding_api.h" - -#include "phpstr/phpstr.h" ZEND_EXTERN_MODULE_GLOBALS(http) diff --git a/http_headers_api.c b/http_headers_api.c index e8cfd69..c04664e 100644 --- a/http_headers_api.c +++ b/http_headers_api.c @@ -15,18 +15,14 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" -#include "ext/standard/php_string.h" +#include "php_http.h" + #include "ext/standard/url.h" +#include "ext/standard/php_string.h" -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" #include "php_http_headers_api.h" -#include "php_http_info_api.h" - -#include ZEND_EXTERN_MODULE_GLOBALS(http); diff --git a/http_info_api.c b/http_info_api.c index dec7664..c544ccb 100644 --- a/http_info_api.c +++ b/http_info_api.c @@ -15,15 +15,12 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" #include "php_http.h" + #include "php_http_api.h" -#include "php_http_std_defs.h" #include "php_http_info_api.h" -#include - ZEND_EXTERN_MODULE_GLOBALS(http); PHP_HTTP_API void _http_info_default_callback(void **nothing, HashTable **headers, http_info *info TSRMLS_DC) diff --git a/http_message_api.c b/http_message_api.c index c28ff6f..b59dace 100644 --- a/http_message_api.c +++ b/http_message_api.c @@ -15,19 +15,19 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" +#define HTTP_WANT_CURL #include "php_http.h" -#include "php_http_std_defs.h" + +#include "SAPI.h" + #include "php_http_api.h" -#include "php_http_message_api.h" +#include "php_http_encoding_api.h" #include "php_http_headers_api.h" -#include "php_http_send_api.h" +#include "php_http_message_api.h" #include "php_http_request_api.h" +#include "php_http_send_api.h" #include "php_http_url_api.h" -#include "php_http_encoding_api.h" - -#include "phpstr/phpstr.h" ZEND_EXTERN_MODULE_GLOBALS(http); diff --git a/http_message_object.c b/http_message_object.c index fbe5fc2..f741e65 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -16,19 +16,16 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#include "php_http.h" #ifdef ZEND_ENGINE_2 -#include "php_http.h" #include "php_http_api.h" -#include "php_http_std_defs.h" +#include "php_http_message_api.h" #include "php_http_message_object.h" #include "php_http_exception_object.h" -#include "phpstr/phpstr.h" -#include "missing.h" - #ifndef WONKY # include "zend_interfaces.h" # if defined(HAVE_SPL) diff --git a/http_request_api.c b/http_request_api.c index 496a63e..e9d39d7 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -15,28 +15,21 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#define HTTP_WANT_CURL +#include "php_http.h" #ifdef HTTP_HAVE_CURL -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" #include "php_http_request_api.h" #include "php_http_request_method_api.h" #include "php_http_url_api.h" + #ifdef ZEND_ENGINE_2 # include "php_http_request_object.h" #endif -#include "phpstr/phpstr.h" - -#ifdef PHP_WIN32 -# include -#endif - -#include - /* {{{ cruft for thread safe SSL crypto locks */ #if defined(ZTS) && defined(HTTP_HAVE_SSL) # ifdef PHP_WIN32 @@ -1041,7 +1034,7 @@ static inline void _http_curl_defaults(CURL *ch) HTTP_CURL_OPT(FOLLOWLOCATION, 0); HTTP_CURL_OPT(UNRESTRICTED_AUTH, 0); HTTP_CURL_OPT(REFERER, NULL); - HTTP_CURL_OPT(USERAGENT, "PECL::HTTP/" HTTP_PEXT_VERSION " (PHP/" PHP_VERSION ")"); + HTTP_CURL_OPT(USERAGENT, "PECL::HTTP/" PHP_EXT_HTTP_VERSION " (PHP/" PHP_VERSION ")"); HTTP_CURL_OPT(HTTPHEADER, NULL); HTTP_CURL_OPT(COOKIE, NULL); HTTP_CURL_OPT(COOKIEFILE, NULL); diff --git a/http_request_method_api.c b/http_request_method_api.c index 873d5b1..9e5c79a 100644 --- a/http_request_method_api.c +++ b/http_request_method_api.c @@ -15,19 +15,18 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" +#define HTTP_WANT_CURL #include "php_http.h" -#include "php_http_std_defs.h" + #include "php_http_api.h" +#include "php_http_request_api.h" #include "php_http_request_method_api.h" -#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) + +#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) && !defined(WONKY) # include "php_http_request_object.h" #endif -#include "missing.h" -#include "phpstr/phpstr.h" - ZEND_EXTERN_MODULE_GLOBALS(http); /* {{{ char *http_request_methods[] */ diff --git a/http_request_object.c b/http_request_object.c index 43cf5a8..925cd6d 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -12,33 +12,25 @@ /* $Id$ */ - #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#define HTTP_WANT_CURL +#include "php_http.h" #if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) #include "zend_interfaces.h" -#include "php_http_std_defs.h" -#include "php_http_request_object.h" -#include "php_http_request_api.h" -#include "php_http_request_pool_api.h" -#include "php_http.h" #include "php_http_api.h" -#include "php_http_url_api.h" +#include "php_http_exception_object.h" #include "php_http_message_api.h" #include "php_http_message_object.h" -#include "php_http_exception_object.h" - -#include "missing.h" - -#ifdef PHP_WIN32 -# include -#endif -#include +#include "php_http_request_api.h" +#include "php_http_request_object.h" +#include "php_http_request_pool_api.h" +#include "php_http_url_api.h" ZEND_EXTERN_MODULE_GLOBALS(http); diff --git a/http_request_pool_api.c b/http_request_pool_api.c index c221f1e..48c1cde 100644 --- a/http_request_pool_api.c +++ b/http_request_pool_api.c @@ -15,16 +15,16 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#define HTTP_WANT_CURL +#include "php_http.h" #if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" #include "php_http_request_api.h" -#include "php_http_request_pool_api.h" #include "php_http_request_object.h" +#include "php_http_request_pool_api.h" #include "php_http_requestpool_object.h" #ifndef HTTP_DEBUG_REQPOOLS diff --git a/http_requestpool_object.c b/http_requestpool_object.c index d9dfb40..3a0c020 100644 --- a/http_requestpool_object.c +++ b/http_requestpool_object.c @@ -12,34 +12,29 @@ /* $Id$ */ - #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#define HTTP_WANT_CURL +#include "php_http.h" #if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) -#include "php_http_std_defs.h" +#include "zend_interfaces.h" + #include "php_http_api.h" -#include "php_http_requestpool_object.h" -#include "php_http_request_pool_api.h" -#include "php_http_request_object.h" #include "php_http_exception_object.h" +#include "php_http_request_api.h" +#include "php_http_request_object.h" +#include "php_http_request_pool_api.h" +#include "php_http_requestpool_object.h" -#include "missing.h" - -#include "zend_interfaces.h" #if defined(HAVE_SPL) && !defined(WONKY) /* SPL doesn't install its headers */ extern PHPAPI zend_class_entry *spl_ce_Countable; #endif -#ifdef PHP_WIN32 -# include -#endif -#include - #define HTTP_BEGIN_ARGS(method, req_args) HTTP_BEGIN_ARGS_EX(HttpRequestPool, method, 0, req_args) #define HTTP_EMPTY_ARGS(method, ret_ref) HTTP_EMPTY_ARGS_EX(HttpRequestPool, method, ret_ref) #define HTTP_REQPOOL_ME(method, visibility) PHP_ME(HttpRequestPool, method, HTTP_ARGS(HttpRequestPool, method), visibility) diff --git a/http_response_object.c b/http_response_object.c index 0d6cfa7..5d46fa5 100644 --- a/http_response_object.c +++ b/http_response_object.c @@ -16,9 +16,9 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" -#include "missing.h" +#define HTTP_WANT_MAGIC +#include "php_http.h" /* broken static properties in PHP 5.0 */ #if defined(ZEND_ENGINE_2) && !defined(WONKY) @@ -26,18 +26,13 @@ #include "SAPI.h" #include "php_ini.h" -#include "php_http.h" #include "php_http_api.h" -#include "php_http_std_defs.h" -#include "php_http_response_object.h" -#include "php_http_exception_object.h" -#include "php_http_send_api.h" #include "php_http_cache_api.h" +#include "php_http_exception_object.h" #include "php_http_headers_api.h" +#include "php_http_response_object.h" +#include "php_http_send_api.h" -#ifdef HTTP_HAVE_MAGIC -# include -#endif ZEND_EXTERN_MODULE_GLOBALS(http); diff --git a/http_send_api.c b/http_send_api.c index d432b5c..8b25674 100644 --- a/http_send_api.c +++ b/http_send_api.c @@ -15,21 +15,20 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#define HTTP_WANT_MAGIC +#include "php_http.h" #include "SAPI.h" #include "php_streams.h" #include "ext/standard/php_lcg.h" -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" -#include "php_http_date_api.h" -#include "php_http_send_api.h" -#include "php_http_headers_api.h" -#include "php_http_date_api.h" #include "php_http_cache_api.h" +#include "php_http_date_api.h" #include "php_http_encoding_api.h" +#include "php_http_headers_api.h" +#include "php_http_send_api.h" ZEND_EXTERN_MODULE_GLOBALS(http); @@ -451,6 +450,64 @@ PHP_HTTP_API STATUS _http_send_stream_ex(php_stream *file, zend_bool close_strea } /* }}} */ +/* {{{ char *http_guess_content_type(char *magic_file, long magic_mode, void *data, size_t size, http_send_mode mode) */ +PHP_HTTP_API char *_http_guess_content_type(const char *magicfile, long magicmode, void *data_ptr, size_t data_len, http_send_mode data_mode TSRMLS_DC) +{ + char *ct = NULL; + +#ifdef HTTP_HAVE_MAGIC + /* magic_load() fails if MAGIC_MIME is set because it + cowardly adds .mime to the file name */ + struct magic_set *magic = magic_open(magicmode &~ MAGIC_MIME); + + if (!magic) { + http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid magic mode: %ld", magicmode); + } else if (-1 == magic_load(magic, magicfile)) { + http_error_ex(HE_WARNING, HTTP_E_RUNTIME, "Failed to load magic database '%s' (%s)", magicfile, magic_error(magic)); + } else { + const char *ctype = NULL; + + magic_setflags(magic, magicmode); + + switch (data_mode) + { + case SEND_RSRC: + { + char *buffer; + size_t b_len; + + b_len = php_stream_copy_to_mem(data_ptr, &buffer, 65536, 0); + ctype = magic_buffer(magic, buffer, b_len); + efree(buffer); + } + break; + + case SEND_DATA: + ctype = magic_buffer(magic, data_ptr, data_len); + break; + + default: + ctype = magic_file(magic, data_ptr); + break; + } + + if (ctype) { + ct = estrdup(ctype); + } else { + http_error_ex(HE_WARNING, HTTP_E_RUNTIME, "Failed to guess Content-Type: %s", magic_error(magic)); + } + } + if (magic) { + magic_close(magic); + } +#else + http_error(HE_WARNING, HTTP_E_RUNTIME, "Cannot guess Content-Type; libmagic not available"); +#endif + + return ct; +} +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/http_url_api.c b/http_url_api.c index 9c35a5c..3fbf008 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -15,25 +15,17 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#define HTTP_WANT_NETDB +#include "php_http.h" #include "SAPI.h" #include "zend_ini.h" #include "php_output.h" #include "ext/standard/url.h" -#include "php_http.h" #include "php_http_api.h" #include "php_http_url_api.h" -#include "php_http_std_defs.h" - -#include "phpstr/phpstr.h" - -#ifdef PHP_WIN32 -# include -#elif defined(HAVE_NETDB_H) -# include -#endif ZEND_EXTERN_MODULE_GLOBALS(http); diff --git a/http_util_object.c b/http_util_object.c index 2a8b469..b2fa5c5 100644 --- a/http_util_object.c +++ b/http_util_object.c @@ -16,12 +16,11 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#include "php_http.h" #ifdef ZEND_ENGINE_2 -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_util_object.h" #define HTTP_BEGIN_ARGS(method, req_args) HTTP_BEGIN_ARGS_EX(HttpUtil, method, 0, req_args) diff --git a/package.xml b/package.xml index bd6baee..c949e5e 100644 --- a/package.xml +++ b/package.xml @@ -1,6 +1,6 @@ - + pecl_http Extended HTTP Support * Building absolute URLs @@ -23,11 +23,15 @@ - 0.18.1 - 2005-11-17 + 0.19.0 + 2005-11-21 BSD, revised beta - * Fixed build with PHP-4 and PHP-5.0 + * Fixed bug in http_negotiate_*() when client sends spaces within accept headers + +- Removed support for ETag hashing through libmhash + ++ Added http_negotiate_content_type() @@ -35,7 +39,6 @@ - @@ -84,7 +87,6 @@ - diff --git a/php_http.h b/php_http.h index 2f0eade..1801943 100644 --- a/php_http.h +++ b/php_http.h @@ -15,17 +15,41 @@ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H -#define HTTP_PEXT_VERSION "0.18.1" +#define PHP_EXT_HTTP_VERSION "0.19.0" -/* make compile on Win32 */ -#ifdef HTTP_HAVE_CURL +#include "php.h" +#include "php_http_std_defs.h" +#include "phpstr/phpstr.h" +#include "missing.h" + + +#ifdef HTTP_WANT_NETDB +# ifdef PHP_WIN32 +# include +# elif defined(HAVE_NETDB_H) +# include +# endif +#endif + +#if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL) # ifdef PHP_WIN32 # include # endif # include #endif -#include "phpstr/phpstr.h" +#if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC) +# if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC) +# define USE_MAGIC_STATIC +# endif +# include +#endif + +#if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB) +# include +#endif + +#include extern zend_module_entry http_module_entry; #define phpext_http_ptr &http_module_entry diff --git a/php_http_api.h b/php_http_api.h index 3073ab4..c6d08d2 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -15,9 +15,6 @@ #ifndef PHP_HTTP_API_H #define PHP_HTTP_API_H -#include "php_http_std_defs.h" -#include "php_http_send_api.h" - #define HTTP_SUPPORT 0x01L #define HTTP_SUPPORT_REQUESTS 0x02L #define HTTP_SUPPORT_MAGICMIME 0x04L @@ -108,12 +105,9 @@ extern STATUS _http_check_method_ex(const char *method, const char *methods); PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_size, zend_bool check TSRMLS_DC); #define http_get_request_body(b, l) _http_get_request_body_ex((b), (l), 1 TSRMLS_CC) -#define http_get_Request_body_ex(b, l, d) _http_get_request_body_ex((b), (l), (d) TSRMLS_CC) +#define http_get_request_body_ex(b, l, d) _http_get_request_body_ex((b), (l), (d) TSRMLS_CC) PHP_HTTP_API STATUS _http_get_request_body_ex(char **body, size_t *length, zend_bool dup TSRMLS_DC); -#define http_guess_content_type(mf, mm, d, l, m) _http_guess_content_type((mf), (mm), (d), (l), (m) TSRMLS_CC) -PHP_HTTP_API char *_http_guess_content_type(const char *magic_file, long magic_mode, void *data_ptr, size_t data_len, http_send_mode mode TSRMLS_DC); - #define http_locate_body _http_locate_body static inline const char *_http_locate_body(const char *message) @@ -182,7 +176,6 @@ static inline zval *_convert_to_type_ex(int type, zval *z, zval **p) return z; } - #endif /* diff --git a/php_http_cache_api.h b/php_http_cache_api.h index e349cc6..1a21ded 100644 --- a/php_http_cache_api.h +++ b/php_http_cache_api.h @@ -15,17 +15,11 @@ #ifndef PHP_HTTP_CACHE_API_H #define PHP_HTTP_CACHE_API_H -#include "zend_ini.h" +#include "php_http_send_api.h" #include "ext/standard/crc32.h" #include "ext/standard/sha1.h" #include "ext/standard/md5.h" - -#include "php_http_std_defs.h" -#include "php_http.h" -#include "php_http_api.h" -#include "php_http_send_api.h" - #if defined(HTTP_HAVE_EXT_HASH) # include "php_hash.h" #elif defined(HTTP_HAVE_HASH_EXT_HASH) diff --git a/php_http_date_api.h b/php_http_date_api.h index 07912d8..e25ad6f 100644 --- a/php_http_date_api.h +++ b/php_http_date_api.h @@ -15,8 +15,6 @@ #ifndef PHP_HTTP_DATE_API_H #define PHP_HTTP_DATE_API_H -#include "php_http_std_defs.h" - #define http_date(t) _http_date((t) TSRMLS_CC) PHP_HTTP_API char *_http_date(time_t t TSRMLS_DC); diff --git a/php_http_encoding_api.h b/php_http_encoding_api.h index a87a8c6..bc3e7da 100644 --- a/php_http_encoding_api.h +++ b/php_http_encoding_api.h @@ -15,10 +15,7 @@ #ifndef PHP_HTTP_ENCODING_API_H #define PHP_HTTP_ENCODING_API_H -#include "php_http_std_defs.h" - #ifdef HTTP_HAVE_ZLIB -# include "phpstr/phpstr.h" # include #endif diff --git a/php_http_exception_object.h b/php_http_exception_object.h index 19d7cda..478aa25 100644 --- a/php_http_exception_object.h +++ b/php_http_exception_object.h @@ -16,6 +16,8 @@ #define PHP_HTTP_EXCEPTION_OBJECT_H #ifdef ZEND_ENGINE_2 +#include "zend_exceptions.h" + PHP_MINIT_FUNCTION(http_exception_object); extern zend_class_entry *http_exception_object_ce; diff --git a/php_http_headers_api.h b/php_http_headers_api.h index d083956..a35fe07 100644 --- a/php_http_headers_api.h +++ b/php_http_headers_api.h @@ -15,7 +15,6 @@ #ifndef PHP_HTTP_HEADERS_API_H #define PHP_HTTP_HEADERS_API_H -#include "php_http_std_defs.h" #include "php_http_info_api.h" #define HTTP_REDIRECT 302L diff --git a/php_http_message_api.h b/php_http_message_api.h index 31f430d..3522685 100644 --- a/php_http_message_api.h +++ b/php_http_message_api.h @@ -16,7 +16,6 @@ #define PHP_HTTP_MESSAGE_API_H #include "php_http_info_api.h" -#include "phpstr/phpstr.h" typedef enum { HTTP_MSG_NONE = 0, diff --git a/php_http_message_object.h b/php_http_message_object.h index e9c8494..3a3dfe8 100644 --- a/php_http_message_object.h +++ b/php_http_message_object.h @@ -16,8 +16,6 @@ #define PHP_HTTP_MESSAGE_OBJECT_H #ifdef ZEND_ENGINE_2 -#include "php_http_message_api.h" - typedef struct { zend_object zo; http_message *message; diff --git a/php_http_request_api.h b/php_http_request_api.h index 1c166a0..7d9a4c7 100644 --- a/php_http_request_api.h +++ b/php_http_request_api.h @@ -17,16 +17,8 @@ #ifdef HTTP_HAVE_CURL -#include "php_http_std_defs.h" #include "php_http_request_method_api.h" -#include "phpstr/phpstr.h" - -#ifdef PHP_WIN32 -# include -#endif -#include - extern PHP_MINIT_FUNCTION(http_request); extern PHP_MSHUTDOWN_FUNCTION(http_request); diff --git a/php_http_request_method_api.h b/php_http_request_method_api.h index 67b3665..88f79d5 100644 --- a/php_http_request_method_api.h +++ b/php_http_request_method_api.h @@ -15,9 +15,6 @@ #ifndef PHP_HTTP_REQUEST_METHOD_API_H #define PHP_HTTP_REQUEST_METHOD_API_H -#include "php_http_std_defs.h" -#include "phpstr/phpstr.h" - typedef enum { HTTP_NO_REQUEST_METHOD = 0, /* HTTP/1.1 */ diff --git a/php_http_request_object.h b/php_http_request_object.h index 7ae1fca..d1ffb7e 100644 --- a/php_http_request_object.h +++ b/php_http_request_object.h @@ -17,15 +17,7 @@ #ifdef HTTP_HAVE_CURL #ifdef ZEND_ENGINE_2 -#ifdef PHP_WIN32 -# include -#endif - -#include - -#include "php_http_request_api.h" #include "php_http_request_pool_api.h" -#include "phpstr/phpstr.h" typedef struct { zend_object zo; diff --git a/php_http_request_pool_api.h b/php_http_request_pool_api.h index e9ea75c..d1ab0b3 100644 --- a/php_http_request_pool_api.h +++ b/php_http_request_pool_api.h @@ -16,16 +16,6 @@ #define PHP_HTTP_REQUEST_POOL_API_H #ifdef HTTP_HAVE_CURL -#include "php_http_std_defs.h" -#include "php_http_request_api.h" -#include "phpstr/phpstr.h" - -#ifdef PHP_WIN32 -# include -#endif - -#include - typedef struct { CURLM *ch; zend_llist finished; diff --git a/php_http_requestpool_object.h b/php_http_requestpool_object.h index 3d71e64..c5af3be 100644 --- a/php_http_requestpool_object.h +++ b/php_http_requestpool_object.h @@ -17,14 +17,6 @@ #ifdef HTTP_HAVE_CURL #ifdef ZEND_ENGINE_2 -#ifdef PHP_WIN32 -# include -#endif - -#include - -#include "php_http_request_pool_api.h" - typedef struct { zend_object zo; http_request_pool pool; diff --git a/php_http_response_object.h b/php_http_response_object.h index 4d6e54b..5fd739c 100644 --- a/php_http_response_object.h +++ b/php_http_response_object.h @@ -15,9 +15,6 @@ #ifndef PHP_HTTP_RESPONSE_OBJECT_H #define PHP_HTTP_RESPONSE_OBJECT_H #ifdef ZEND_ENGINE_2 - -#include "missing.h" - #ifndef WONKY extern zend_class_entry *http_response_object_ce; diff --git a/php_http_send_api.h b/php_http_send_api.h index 9d79a2d..29370b8 100644 --- a/php_http_send_api.h +++ b/php_http_send_api.h @@ -15,10 +15,6 @@ #ifndef PHP_HTTP_SEND_API_H #define PHP_HTTP_SEND_API_H -#include "SAPI.h" -#include "php_streams.h" -#include "php_http_std_defs.h" - typedef enum { SEND_DATA, SEND_RSRC @@ -62,6 +58,9 @@ PHP_HTTP_API STATUS _http_send_ex(const void *data, size_t data_size, http_send_ #define http_send_stream_ex(s, c, nc) _http_send_stream_ex((s), (c), (nc) TSRMLS_CC) PHP_HTTP_API STATUS _http_send_stream_ex(php_stream *s, zend_bool close_stream, zend_bool no_cache TSRMLS_DC); +#define http_guess_content_type(mf, mm, d, l, m) _http_guess_content_type((mf), (mm), (d), (l), (m) TSRMLS_CC) +PHP_HTTP_API char *_http_guess_content_type(const char *magic_file, long magic_mode, void *data_ptr, size_t data_len, http_send_mode mode TSRMLS_DC); + #endif /* diff --git a/php_http_url_api.h b/php_http_url_api.h index 4a4080f..77e6ef0 100644 --- a/php_http_url_api.h +++ b/php_http_url_api.h @@ -15,8 +15,6 @@ #ifndef PHP_HTTP_URL_API_H #define PHP_HTTP_URL_API_H -#include "php_http_std_defs.h" - #define http_absolute_uri(url) http_absolute_url(url) #define http_absolute_uri_ex(url, url_len, proto, proto_len, host, host_len, port) _http_absolute_url_ex((url), (url_len), (proto), (proto_len), (host), (host_len), (port) TSRMLS_CC) #define http_absolute_url(url) http_absolute_url_ex((url), strlen(url), NULL, 0, NULL, 0, 0) diff --git a/tests/etag_mode_034.phpt b/tests/etag_mode_034.phpt index f0930ad..bc9d311 100644 --- a/tests/etag_mode_034.phpt +++ b/tests/etag_mode_034.phpt @@ -14,11 +14,11 @@ http_cache_etag(); http_send_data("abc\n"); ?> --EXPECTF-- -Content-type: %s X-Powered-By: PHP/%s Cache-Control: private, must-revalidate, max-age=0 Accept-Ranges: bytes ETag: "edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb" Content-Length: 4 +Content-type: %s abc