mike Mon Oct 17 11:56:47 2005 EDT
Modified files:
/pecl/http http_encoding_api.c http_message_api.c
http_util_object.c
Log:
- fixed issues ifndef HTTP_HAVE_ZLIB and enable gzipped response decoding
ifdef HAVE_ZLIB
http://cvs.php.net/diff.php/pecl/http/http_encoding_api.c?r1=1.14&r2=1.15&ty=u
Index: pecl/http/http_encoding_api.c
diff -u pecl/http/http_encoding_api.c:1.14 pecl/http/http_encoding_api.c:1.15
--- pecl/http/http_encoding_api.c:1.14 Mon Oct 17 10:19:17 2005
+++ pecl/http/http_encoding_api.c Mon Oct 17 11:56:39 2005
@@ -13,7 +13,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http_encoding_api.c,v 1.14 2005/10/17 14:19:17 mike Exp $ */
+/* $Id: http_encoding_api.c,v 1.15 2005/10/17 15:56:39 mike Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -592,6 +592,7 @@
}
} else {
#ifndef HTTP_HAVE_ZLIB
+ HTTP_G(send).gzip_encoding = 0;
php_start_ob_buffer_named("ob_gzhandler", 0, 0
TSRMLS_CC);
#else
HashTable *selected;
http://cvs.php.net/diff.php/pecl/http/http_message_api.c?r1=1.38&r2=1.39&ty=u
Index: pecl/http/http_message_api.c
diff -u pecl/http/http_message_api.c:1.38 pecl/http/http_message_api.c:1.39
--- pecl/http/http_message_api.c:1.38 Fri Oct 14 06:51:53 2005
+++ pecl/http/http_message_api.c Mon Oct 17 11:56:40 2005
@@ -13,7 +13,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http_message_api.c,v 1.38 2005/10/14 10:51:53 mike Exp $ */
+/* $Id: http_message_api.c,v 1.39 2005/10/17 15:56:40 mike Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -216,20 +216,42 @@
continue_at = body;
}
-#ifdef HTTP_HAVE_ZLIB
+#if defined(HTTP_HAVE_ZLIB) || defined(HAVE_ZLIB)
/* check for compressed data */
if (c = http_message_header(msg, "Content-Encoding")) {
char *decoded = NULL;
size_t decoded_len = 0;
+# ifdef HAVE_ZLIB
+ zval func, retval, arg, *args[1];
+ INIT_PZVAL(&func);
+ INIT_PZVAL(&retval);
+ INIT_PZVAL(&arg);
+ ZVAL_STRINGL(&func, "gzinflate", lenof("gzinflate"), 0);
+ args[0] = &arg;
+# endif /* HAVE_ZLIB */
+
+# define DECODE_WITH_EXT_ZLIB() \
+ if (SUCCESS ==
call_user_function(EG(function_table), NULL, &func, &retval, 1, args
TSRMLS_CC)) { \
+ if (Z_TYPE(retval) == IS_STRING) { \
+ decoded = Z_STRVAL(retval); \
+ decoded_len = Z_STRLEN(retval);
\
+ } \
+ }
- if (!strcasecmp(Z_STRVAL_P(c), "gzip")) {
+ if (!strcasecmp(Z_STRVAL_P(c), "gzip") ||
!strcasecmp(Z_STRVAL_P(c), "x-gzip")) {
+# ifdef HTTP_HAVE_ZLIB
http_encoding_gzdecode(PHPSTR_VAL(msg),
PHPSTR_LEN(msg), &decoded, &decoded_len);
- } else
- if (!strcasecmp(Z_STRVAL_P(c), "deflate")) {
+# else
+ ZVAL_STRINGL(&arg, PHPSTR_VAL(msg) + 10,
PHPSTR_LEN(msg) - 18, 0);
+ DECODE_WITH_EXT_ZLIB();
+# endif /* HTTP_HAVE_ZLIB */
+ } else if (!strcasecmp(Z_STRVAL_P(c), "deflate")) {
+# ifdef HTTP_HAVE_ZLIB
http_encoding_inflate(PHPSTR_VAL(msg),
PHPSTR_LEN(msg), &decoded, &decoded_len);
- } else
- if (!strcasecmp(Z_STRVAL_P(c), "compress")) {
- http_encoding_uncompress(PHPSTR_VAL(msg),
PHPSTR_LEN(msg), &decoded, &decoded_len);
+# else
+ ZVAL_STRINGL(&arg, PHPSTR_VAL(msg),
PHPSTR_LEN(msg), 0);
+ DECODE_WITH_EXT_ZLIB();
+# endif /* HTTP_HAVE_ZLIB */
}
if (decoded && decoded_len) {
@@ -251,7 +273,7 @@
PHPSTR(msg)->free = 1;
}
}
-#endif
+#endif /* HTTP_HAVE_ZLIB || HAVE_ZLIB */
/* check for following messages */
if (continue_at) {
http://cvs.php.net/diff.php/pecl/http/http_util_object.c?r1=1.16&r2=1.17&ty=u
Index: pecl/http/http_util_object.c
diff -u pecl/http/http_util_object.c:1.16 pecl/http/http_util_object.c:1.17
--- pecl/http/http_util_object.c:1.16 Tue Oct 11 13:11:36 2005
+++ pecl/http/http_util_object.c Mon Oct 17 11:56:42 2005
@@ -13,7 +13,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http_util_object.c,v 1.16 2005/10/11 17:11:36 mike Exp $ */
+/* $Id: http_util_object.c,v 1.17 2005/10/17 15:56:42 mike Exp $ */
#ifdef HAVE_CONFIG_H
@@ -124,12 +124,14 @@
HTTP_UTIL_ALIAS(parseMessage, http_parse_message)
HTTP_UTIL_ALIAS(parseHeaders, http_parse_headers)
HTTP_UTIL_ALIAS(chunkedDecode, http_chunked_decode)
+#ifdef HTTP_HAVE_ZLIB
HTTP_UTIL_ALIAS(gzEncode, http_gzencode)
HTTP_UTIL_ALIAS(gzDecode, http_gzdecode)
HTTP_UTIL_ALIAS(deflate, http_deflate)
HTTP_UTIL_ALIAS(inflate, http_inflate)
HTTP_UTIL_ALIAS(compress, http_compress)
HTTP_UTIL_ALIAS(uncompress, http_uncompress)
+#endif /* HTTP_HAVE_ZLIB */
HTTP_UTIL_ALIAS(support, http_support)
EMPTY_FUNCTION_ENTRY
|