From: Michael Wallner Date: Tue, 10 Jan 2006 15:55:13 +0000 (+0000) Subject: - enable zlib by default X-Git-Tag: RELEASE_1_0_4~6 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=f0fefacf671ffdf395c92f4fe5a229140f8b8ce8;p=m6w6%2Fext-http - enable zlib by default - simplify request method info - fix tests; run-tests ENV support has changed drastically --- diff --git a/LICENSE b/LICENSE index a54036e..2bfd876 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2005, Michael Wallner . +Copyright (c) 2004-2006, Michael Wallner . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The date parser in file http_date_api.c is derived from the implementation found in the original libcurl source, licensed under the following conditions: -Copyright (c) 1996 - 2005, Daniel Stenberg, . +Copyright (c) 1996 - 2006, Daniel Stenberg, . All rights reserved. Permission to use, copy, modify, and distribute this software for any purpose @@ -44,3 +44,4 @@ OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. + diff --git a/config.m4 b/config.m4 index 0afce19..0d1c283 100644 --- a/config.m4 +++ b/config.m4 @@ -9,7 +9,7 @@ PHP_ARG_WITH([http-curl-requests], [whether to enable cURL HTTP request support] HTTP: with cURL request support], "yes") PHP_ARG_WITH([http-zlib-compression], [whether to enable zlib encodings support], [ --with-http-zlib-compression[=LIBZDIR] - HTTP: with zlib encodings support]) + HTTP: with zlib encodings support], "yes") PHP_ARG_WITH([http-magic-mime], [whether to enable response content type guessing], [ --with-http-magic-mime[=LIBMAGICDIR] HTTP: with magic mime response content type guessing]) diff --git a/http.c b/http.c index f5f66a7..05244d1 100644 --- a/http.c +++ b/http.c @@ -345,6 +345,14 @@ PHP_MINFO_FUNCTION(http) # ifndef WONKY "HttpResponse" # endif +#endif + ); + php_info_print_table_row(2, "Output Handlers", "ob_deflatehandler, ob_inflatehandler, ob_etaghandler"); + php_info_print_table_row(2, "Stream Filters", +#ifndef ZEND_ENGINE_2 + "none" +#else + "http.chunked_decode, http.chunked_encode, http.deflate, http.inflate" #endif ); } @@ -377,17 +385,13 @@ PHP_MINFO_FUNCTION(http) { int i; getGlobals(G); - struct _entry {char *name; char *cnst;} *entry; - phpstr *known_request_methods = phpstr_new(); phpstr *custom_request_methods = phpstr_new(); + phpstr *known_request_methods = phpstr_from_string(HTTP_KNOWN_METHODS, lenof(HTTP_KNOWN_METHODS)); + http_request_method_entry **ptr = G->request.methods.custom.entries; - for (i = HTTP_MIN_REQUEST_METHOD; i < HTTP_MAX_REQUEST_METHOD; ++i) { - phpstr_appendl(known_request_methods, http_request_method_name(i)); - phpstr_appends(known_request_methods, ", "); - } for (i = 0; i < G->request.methods.custom.count; ++i) { - if ((entry = ((struct _entry **) G->request.methods.custom.entries)[i])) { - phpstr_appendf(custom_request_methods, "%s, ", entry->name); + if (ptr[i]) { + phpstr_appendf(custom_request_methods, "%s, ", ptr[i]->name); } } @@ -398,7 +402,7 @@ PHP_MINFO_FUNCTION(http) php_info_print_table_row(2, "Known", PHPSTR_VAL(known_request_methods)); php_info_print_table_row(2, "Custom", PHPSTR_LEN(custom_request_methods) ? PHPSTR_VAL(custom_request_methods) : "none registered"); - php_info_print_table_row(2, "Allowed", strlen(HTTP_G(request).methods.allowed) ? HTTP_G(request).methods.allowed : "(ANY)"); + php_info_print_table_row(2, "Allowed", strlen(G->request.methods.allowed) ? G->request.methods.allowed : "(ANY)"); phpstr_free(&known_request_methods); phpstr_free(&custom_request_methods); diff --git a/http_url_api.c b/http_url_api.c index 517ee1a..6ca3351 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -47,7 +47,7 @@ PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC) /* {{{ void http_build_url(const php_url *, const php_url *, php_url **, char **, size_t *) */ PHP_HTTP_API void _http_build_url(const php_url *old_url, const php_url *new_url, php_url **url_ptr, char **url_str, size_t *url_len TSRMLS_DC) { -#if defined(PHP_WIN32) || defined(HAVE_NETDB_H) +#ifdef HTTP_HAVE_NETDB struct servent *se; #endif php_url *url = emalloc(sizeof(php_url)); @@ -70,14 +70,14 @@ PHP_HTTP_API void _http_build_url(const php_url *old_url, const php_url *new_url url->scheme = estrndup("https", lenof("https")); break; -#if !defined(PHP_WIN32) && !defined(HAVE_NETDB_H) +#ifndef HTTP_HAVE_NETDB default: #endif case 80: url->scheme = estrndup("http", lenof("http")); break; -#if defined(PHP_WIN32) || defined(HAVE_NETDB_H) +#ifdef HTTP_HAVE_NETDB default: if ((se = getservbyport(htons(url->port), "tcp")) && se->s_name) { url->scheme = estrdup(se->s_name); @@ -139,7 +139,7 @@ PHP_HTTP_API void _http_build_url(const php_url *old_url, const php_url *new_url if (url->port) { if ( ((url->port == 80) && !strcmp(url->scheme, "http")) || ((url->port ==443) && !strcmp(url->scheme, "https")) -#if defined(PHP_WIN32) || defined(HAVE_NETDB_H) +#ifdef HTTP_HAVE_NETDB || ((se = getservbyname(url->scheme, "tcp")) && se->s_port && (url->port == ntohs(se->s_port))) #endif diff --git a/php_http.h b/php_http.h index 66a7a9a..a3cb94f 100644 --- a/php_http.h +++ b/php_http.h @@ -24,8 +24,10 @@ #ifdef HTTP_WANT_NETDB # ifdef PHP_WIN32 +# define HTTP_HAVE_NETDB # include # elif defined(HAVE_NETDB_H) +# define HTTP_HAVE_NETDB # include # endif #endif @@ -93,7 +95,7 @@ ZEND_BEGIN_MODULE_GLOBALS(http) struct _http_globals_request { struct _http_globals_request_methods { char *allowed; - struct { + struct _http_globals_request_methods_custom { int count; void *entries; } custom; diff --git a/tests/negotiation_001.phpt b/tests/negotiation_001.phpt index d4b13ac..df42ff6 100644 --- a/tests/negotiation_001.phpt +++ b/tests/negotiation_001.phpt @@ -4,13 +4,12 @@ negotiation ---ENV-- -HTTP_ACCEPT=application/xml, application/xhtml+xml, text/html ; q = .8 -HTTP_ACCEPT_LANGUAGE=de-AT,de-DE;q=0.8,en-GB;q=0.3,en-US;q=0.2 -HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7 --FILE-- ---ENV-- -HTTP_RANGE=bytes=-5 --FILE-- diff --git a/tests/send_data_002.phpt b/tests/send_data_002.phpt index 3e982df..4e8f07b 100644 --- a/tests/send_data_002.phpt +++ b/tests/send_data_002.phpt @@ -5,10 +5,9 @@ http_send_data() NUM-NUM range include 'skip.inc'; checkcgi(); ?> ---ENV-- -HTTP_RANGE=bytes=5-6 --FILE-- diff --git a/tests/send_data_003.phpt b/tests/send_data_003.phpt index bbc8d78..87663fc 100644 --- a/tests/send_data_003.phpt +++ b/tests/send_data_003.phpt @@ -5,10 +5,9 @@ http_send_data() NUM-NIL range include 'skip.inc'; checkcgi(); ?> ---ENV-- -HTTP_RANGE=bytes=5981- --FILE-- diff --git a/tests/send_data_005.phpt b/tests/send_data_005.phpt index 2cbb717..286c7e9 100644 --- a/tests/send_data_005.phpt +++ b/tests/send_data_005.phpt @@ -5,10 +5,9 @@ http_send_data() oversized range include 'skip.inc'; checkcgi(); ?> ---ENV-- -HTTP_RANGE=bytes=5990-6000 --FILE-- diff --git a/tests/send_data_006.phpt b/tests/send_data_006.phpt index 43d7a93..7771b8b 100644 --- a/tests/send_data_006.phpt +++ b/tests/send_data_006.phpt @@ -9,6 +9,7 @@ checkcgi(); HTTP_RANGE=bytes=0-3, 4-5,9-11 --FILE-- diff --git a/tests/send_file_005.phpt b/tests/send_file_005.phpt index d6705ea..b5287a3 100644 --- a/tests/send_file_005.phpt +++ b/tests/send_file_005.phpt @@ -5,10 +5,9 @@ http_send_file() multiple ranges include 'skip.inc'; checkcgi(); ?> ---ENV-- -HTTP_RANGE=bytes=0-3, 4-5,9-11 --FILE-- diff --git a/tests/send_file_009.phpt b/tests/send_file_009.phpt index bc157a9..3215b03 100644 --- a/tests/send_file_009.phpt +++ b/tests/send_file_009.phpt @@ -6,10 +6,9 @@ include 'skip.inc'; checkcgi(); checkmin(5.1); ?> ---ENV-- -HTTP_RANGE=bytes=5-9 --FILE-- --EXPECTF-- diff --git a/tests/send_file_010.phpt b/tests/send_file_010.phpt index 20b853a..8ee6eac 100644 --- a/tests/send_file_010.phpt +++ b/tests/send_file_010.phpt @@ -6,10 +6,9 @@ include 'skip.inc'; checkcgi(); checkmin(5.1); ?> ---ENV-- -HTTP_RANGE=bytes=-9 --FILE-- --EXPECTF-- diff --git a/tests/send_file_011.phpt b/tests/send_file_011.phpt index 5ac521f..1012da4 100644 --- a/tests/send_file_011.phpt +++ b/tests/send_file_011.phpt @@ -6,10 +6,9 @@ include 'skip.inc'; checkcgi(); checkmin(5.1); ?> ---ENV-- -HTTP_RANGE=bytes=1000- --FILE-- --EXPECTF-- diff --git a/tests/send_file_013.phpt b/tests/send_file_013.phpt index e97a091..1315488 100644 --- a/tests/send_file_013.phpt +++ b/tests/send_file_013.phpt @@ -6,10 +6,9 @@ include 'skip.inc'; checkcgi(); checkmin(5.1); ?> ---ENV-- -HTTP_RANGE=bytes=-1111 --FILE-- --EXPECTF--