cvs: pecl /http http_encoding_api.c http_response_object.c http_send_api.c package2.xml php_http.h php_http_encoding_api.h

From: Date: Sat, 07 Oct 2006 12:46:22 +0000
Subject: cvs: pecl /http http_encoding_api.c http_response_object.c http_send_api.c package2.xml php_http.h php_http_encoding_api.h
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-6467@lists.php.net to get a copy of this message
mike Sat Oct 7 12:46:22 2006 UTC Modified files: /pecl/http http_encoding_api.c http_response_object.c http_send_api.c package2.xml php_http.h php_http_encoding_api.h Log: - attempt to fix bug #8872 (build fails --without-http-zlib-compression) - finally fix invalid detection wheter a deflated response should be started

http://cvs.php.net/viewvc.cgi/pecl/http/http_encoding_api.c?r1=1.59&r2=1.60&diff_format=u Index: pecl/http/http_encoding_api.c diff -u pecl/http/http_encoding_api.c:1.59 pecl/http/http_encoding_api.c:1.60 --- pecl/http/http_encoding_api.c:1.59 Mon Sep 25 13:32:03 2006 +++ pecl/http/http_encoding_api.c Sat Oct 7 12:46:22 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_encoding_api.c,v 1.59 2006/09/25 13:32:03 mike Exp $ */ +/* $Id: http_encoding_api.c,v 1.60 2006/10/07 12:46:22 mike Exp $ */ #define HTTP_WANT_ZLIB #include "php_http.h" @@ -158,18 +158,22 @@ /* }}} */ /* {{{ int http_encoding_response_start(size_t) */ -PHP_HTTP_API int _http_encoding_response_start(size_t content_length TSRMLS_DC) +PHP_HTTP_API int _http_encoding_response_start(size_t content_length, zend_bool ignore_http_ohandler TSRMLS_DC) { - int is_http = HTTP_G->send.deflate.encoding; - int is_zlib = php_ob_handler_used("ob_gzhandler" TSRMLS_CC) || php_ob_handler_used("zlib output compression" TSRMLS_CC); + int response = HTTP_G->send.deflate.response; + int ohandler = php_ob_handler_used("ob_gzhandler" TSRMLS_CC) || php_ob_handler_used("zlib output compression" TSRMLS_CC); - HTTP_G->send.deflate.encoding = 0; + if (!ohandler && !ignore_http_ohandler) { + ohandler = php_ob_handler_used("ob_deflatehandler" TSRMLS_CC) || php_ob_handler_used("http deflate" TSRMLS_CC); + } - if (is_http && !is_zlib) { + if (response && !ohandler) { #ifdef HTTP_HAVE_ZLIB HashTable *selected; zval zsupported; + HTTP_G->send.deflate.encoding = 0; + INIT_PZVAL(&zsupported); array_init(&zsupported); add_next_index_stringl(&zsupported, "gzip", lenof("gzip"), 1); @@ -202,14 +206,17 @@ zval_dtor(&zsupported); #else + HTTP_G->send.deflate.encoding = 0; php_start_ob_buffer_named("ob_gzhandler", 0, 0 TSRMLS_CC); #endif /* HTTP_HAVE_ZLIB */ - } else if (content_length && !is_zlib) { + } else if (content_length && !ohandler) { /* emit a content-length header */ char cl_header_str[128]; size_t cl_header_len; cl_header_len = snprintf(cl_header_str, lenof(cl_header_str), "Content-Length: %zu", content_length); http_send_header_string_ex(cl_header_str, cl_header_len, 1); + } else { + HTTP_G->send.deflate.encoding = 0; } return HTTP_G->send.deflate.encoding; @@ -651,6 +658,8 @@ /* {{{ void http_ob_deflatehandler(char *, uint, char **, uint *, int) */ void _http_ob_deflatehandler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) { + int encoding; + *handled_output = NULL; *handled_output_len = 0; @@ -662,9 +671,11 @@ return; } - HTTP_G->send.deflate.encoding = !0; + HTTP_G->send.deflate.response = 1; + encoding = http_encoding_response_start(0, 1); + HTTP_G->send.deflate.response = 0; - switch (http_encoding_response_start(0)) { + switch (encoding) { case HTTP_ENCODING_GZIP: flags = HTTP_DEFLATE_TYPE_GZIP; break; http://cvs.php.net/viewvc.cgi/pecl/http/http_response_object.c?r1=1.88&r2=1.89&diff_format=u Index: pecl/http/http_response_object.c diff -u pecl/http/http_response_object.c:1.88 pecl/http/http_response_object.c:1.89 --- pecl/http/http_response_object.c:1.88 Fri Jul 21 16:51:53 2006 +++ pecl/http/http_response_object.c Sat Oct 7 12:46:22 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_response_object.c,v 1.88 2006/07/21 16:51:53 mike Exp $ */ +/* $Id: http_response_object.c,v 1.89 2006/10/07 12:46:22 mike Exp $ */ #define HTTP_WANT_SAPI #define HTTP_WANT_MAGIC @@ -1154,7 +1154,7 @@ } /* gzip */ - HTTP_G->send.deflate.encoding = zval_is_true(GET_STATIC_PROP(gzip)); + HTTP_G->send.deflate.response = zval_is_true(GET_STATIC_PROP(gzip)); /* send */ switch (Z_LVAL_P(GET_STATIC_PROP(mode))) { http://cvs.php.net/viewvc.cgi/pecl/http/http_send_api.c?r1=1.62&r2=1.63&diff_format=u Index: pecl/http/http_send_api.c diff -u pecl/http/http_send_api.c:1.62 pecl/http/http_send_api.c:1.63 --- pecl/http/http_send_api.c:1.62 Mon Sep 25 10:45:41 2006 +++ pecl/http/http_send_api.c Sat Oct 7 12:46:22 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_send_api.c,v 1.62 2006/09/25 10:45:41 mike Exp $ */ +/* $Id: http_send_api.c,v 1.63 2006/10/07 12:46:22 mike Exp $ */ #define HTTP_WANT_SAPI #define HTTP_WANT_ZLIB @@ -51,7 +51,7 @@ { int encoding; - if ((encoding = http_encoding_response_start(content_length))) { + if ((encoding = http_encoding_response_start(content_length, 0))) { #ifdef HTTP_HAVE_ZLIB *buffer = http_encoding_deflate_stream_init(NULL, (encoding == HTTP_ENCODING_GZIP) ? @@ -65,7 +65,7 @@ #define http_send_response_data_plain(b, d, dl) _http_send_response_data_plain((b), (d), (dl) TSRMLS_CC) static inline void _http_send_response_data_plain(void **buffer, const char *data, size_t data_len TSRMLS_DC) { - if (HTTP_G->send.deflate.encoding && *(http_encoding_stream **) buffer) { + if (HTTP_G->send.deflate.response && HTTP_G->send.deflate.encoding) { #ifdef HTTP_HAVE_ZLIB char *encoded; size_t encoded_len; @@ -137,7 +137,7 @@ #define http_send_response_finish(b) _http_send_response_finish((b) TSRMLS_CC) static inline void _http_send_response_finish(void **buffer TSRMLS_DC) { - if (HTTP_G->send.deflate.encoding && *(http_encoding_stream **) buffer) { + if (HTTP_G->send.deflate.response && HTTP_G->send.deflate.encoding) { #ifdef HTTP_HAVE_ZLIB char *encoded = NULL; size_t encoded_len = 0; http://cvs.php.net/viewvc.cgi/pecl/http/package2.xml?r1=1.130&r2=1.131&diff_format=u Index: pecl/http/package2.xml diff -u pecl/http/package2.xml:1.130 pecl/http/package2.xml:1.131 --- pecl/http/package2.xml:1.130 Mon Oct 2 14:12:40 2006 +++ pecl/http/package2.xml Sat Oct 7 12:46:22 2006 @@ -28,9 +28,9 @@ <email>mike@php.net</email> <active>yes</active> </lead> - <date>2006-10-02</date> + <date>2006-10-07</date> <version> - <release>1.3.1</release> + <release>1.3.2</release> <api>1.3.0</api> </version> <stability> @@ -39,8 +39,8 @@ </stability> <license>BSD, revised</license> <notes><![CDATA[ -* Fixed build with gcc-2.95 (bug #8737) -* Fixed bug in HttpRequestPool where a negative timeout was passed to select() +* Fixed invalid detection whether a deflated response should be started +* Fixed build --without-http-zlib-compression (bug #8872) ]]></notes> <contents> <dir name="/"> http://cvs.php.net/viewvc.cgi/pecl/http/php_http.h?r1=1.168&r2=1.169&diff_format=u Index: pecl/http/php_http.h diff -u pecl/http/php_http.h:1.168 pecl/http/php_http.h:1.169 --- pecl/http/php_http.h:1.168 Mon Oct 2 14:12:40 2006 +++ pecl/http/php_http.h Sat Oct 7 12:46:22 2006 @@ -10,12 +10,12 @@ +--------------------------------------------------------------------+ */ -/* $Id: php_http.h,v 1.168 2006/10/02 14:12:40 mike Exp $ */ +/* $Id: php_http.h,v 1.169 2006/10/07 12:46:22 mike Exp $ */ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H -#define PHP_EXT_HTTP_VERSION "1.3.1" +#define PHP_EXT_HTTP_VERSION "1.3.2" #ifdef HAVE_CONFIG_H # include "config.h" @@ -102,6 +102,7 @@ char *unquoted_etag; time_t last_modified; struct _http_globals_send_deflate { + zend_bool response; zend_bool start_auto; long start_flags; int encoding; http://cvs.php.net/viewvc.cgi/pecl/http/php_http_encoding_api.h?r1=1.23&r2=1.24&diff_format=u Index: pecl/http/php_http_encoding_api.h diff -u pecl/http/php_http_encoding_api.h:1.23 pecl/http/php_http_encoding_api.h:1.24 --- pecl/http/php_http_encoding_api.h:1.23 Fri Apr 21 11:42:14 2006 +++ pecl/http/php_http_encoding_api.h Sat Oct 7 12:46:22 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: php_http_encoding_api.h,v 1.23 2006/04/21 11:42:14 mike Exp $ */ +/* $Id: php_http_encoding_api.h,v 1.24 2006/10/07 12:46:22 mike Exp $ */ #ifndef PHP_HTTP_ENCODING_API_H #define PHP_HTTP_ENCODING_API_H @@ -18,8 +18,8 @@ #define http_encoding_dechunk(e, el, d, dl) _http_encoding_dechunk((e), (el), (d), (dl) TSRMLS_CC) PHP_HTTP_API const char *_http_encoding_dechunk(const char *encoded, size_t encoded_len, char **decoded, size_t *decoded_len TSRMLS_DC); -#define http_encoding_response_start(cl) _http_encoding_response_start((cl) TSRMLS_CC) -PHP_HTTP_API int _http_encoding_response_start(size_t content_length TSRMLS_DC); +#define http_encoding_response_start(cl, i) _http_encoding_response_start((cl), (i) TSRMLS_CC) +PHP_HTTP_API int _http_encoding_response_start(size_t content_length, zend_bool ignore_http_ohandler TSRMLS_DC); #ifdef HTTP_HAVE_ZLIB
« previous php.pecl.cvs (#6467) next »