- allow requests for compressed content even if neither curl nor ext/http
authorMichael Wallner <mike@php.net>
Sat, 10 Dec 2005 17:02:51 +0000 (17:02 +0000)
committerMichael Wallner <mike@php.net>
Sat, 10 Dec 2005 17:02:51 +0000 (17:02 +0000)
  were built with zlib support
- let curl compose the accpt-encoding header if it was built with zlib support,
  because it will bail out if it receives anything else it doesn't support

# if an<one knows a site that uses something else than gzip encoding, let me know! ;)

config.m4
config.w32
http_request_api.c

index 2ff41aa45241dc356469d3d6b310dde7515c8cff..26832b9986f29798377242ab6f1510e4eb9691f1 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -79,6 +79,11 @@ dnl ----
                
                CURL_LIBS=`$CURL_CONFIG --libs`
                
+               CURL_ZLIB= `$CURL_CONFIG --features | $EGREP libz`
+               if test "$CURL_ZLIB" = "libz"; then
+                       AC_DEFINE([HTTP_HAVE_CURL_ZLIB], [1], [ ])
+               fi
+               
                AC_MSG_CHECKING([for SSL support in libcurl])
                CURL_SSL=`$CURL_CONFIG --features | $EGREP SSL`
                if test "$CURL_SSL" = "SSL"; then
index 503e7aeeaf5334bffe4ad2aa3933144a38223aa0..9012de6d3501057d8a938daf26947e004882111f 100644 (file)
@@ -90,6 +90,7 @@ if (PHP_HTTP != "no") {
                        CHECK_LIB("zlib.lib", "http", PHP_HTTP) &&
                        CHECK_LIB("winmm.lib", "http", PHP_HTTP)) {
                AC_DEFINE("HTTP_HAVE_CURL", 1, "Have CURL library");
+               AC_DEFINE("HTTP_HAVE_CURL_ZLIB", 1, "");
                AC_DEFINE("HTTP_HAVE_SSL", 1, "Have SSL");
                AC_DEFINE("HAVE_CURL_MULTI_STRERROR", 1, "");
                AC_DEFINE("HAVE_CURL_EASY_STRERROR", 1, "");
index c43aa1abfa3cd3a013a368359f4e369dcf573227..38eadf45f24343b653faa7aae58e5d748fbc59be 100644 (file)
@@ -467,10 +467,10 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char
 
        /* compress, empty string enables all supported if libcurl was build with zlib support */
        if ((zoption = http_curl_getopt(options, "compress", IS_BOOL)) && Z_LVAL_P(zoption)) {
-#if defined(HTTP_HAVE_ZLIB) || defined(HAVE_ZLIB)
-               HTTP_CURL_OPT(ENCODING, "gzip;q=1.0, deflate;q=0.5, *;q=0.1");
-#else
+#ifdef HTTP_HAVE_CURL_ZLIB
                HTTP_CURL_OPT(ENCODING, "");
+#else
+               HTTP_CURL_OPT(ENCODING, "gzip;q=1.0, deflate;q=0.5, *;q=0.1");
 #endif
        }