fence new altsvc and hsts features
authorMichael Wallner <mike@php.net>
Tue, 9 Mar 2021 07:44:20 +0000 (08:44 +0100)
committerMichael Wallner <mike@php.net>
Tue, 9 Mar 2021 07:44:20 +0000 (08:44 +0100)
autoconf/pecl/libcurl.m4
config9.m4
src/php_http_client_curl.c

index fce643748743911517316e35f8d6e790c33864c0..4d9920741f7ec73285d39d900813f0c9a22182da 100644 (file)
@@ -7,7 +7,7 @@ dnl
 AC_DEFUN([PECL_HAVE_LIBCURL_FEATURE], [dnl
        AC_REQUIRE([PECL_PROG_EGREP])dnl
        AC_CACHE_CHECK([for $1 feature in libcurl], PECL_CACHE_VAR([HAVE_LIBCURL_FEATURE_$1]), [
-               if $CURL_CONFIG --feature | $EGREP -q $1; then
+               if $CURL_CONFIG --feature | $EGREP -qi $1; then
                        PECL_CACHE_VAR([HAVE_LIBCURL_FEATURE_$1])=yes
                else
                        PECL_CACHE_VAR([HAVE_LIBCURL_FEATURE_$1])=no
@@ -225,4 +225,4 @@ AC_DEFUN([PECL_CHECK_LIBCURL], [dnl
        ifelse([$2],,,[
                PECL_HAVE_VERSION([libcurl], [$2])
        ])
-])
\ No newline at end of file
+])
index d653a7c72fa9101be03f92cfb6b48bf4147d474f..ef7d33eabedef510e0d9c1f692f2af7869bfc73a 100644 (file)
@@ -44,6 +44,8 @@ if test "$PHP_HTTP" != "no"; then
                PECL_CHECK_LIBCURL([$PHP_HTTP_LIBCURL_DIR], [7.18.2])
                PECL_HAVE_LIBCURL_PROTOCOL([HTTP], [
                        PECL_HAVE_LIBCURL_FEATURE([HTTP2])
+                       PECL_HAVE_LIBCURL_FEATURE([ALT-SVC])
+                       PECL_HAVE_LIBCURL_FEATURE([HSTS])
                        PECL_HAVE_LIBCURL_ARES
                        PECL_HAVE_LIBCURL_SSL
                        PECL_HAVE_LIBCURL_CA
index 849b4e239a2845f05f322e064c3030849907a06c..915b8fc31f506ccf1aec46abd6a343bd5d7cd30d 100644 (file)
@@ -1683,18 +1683,30 @@ static void php_http_curle_options_init(php_http_options_t *registry)
        }
 
 #if PHP_HTTP_CURL_VERSION(7,64,1)
+# if !PHP_HTTP_HAVE_LIBCURL_ALT_SVC
+       if (PHP_HTTP_CURL_FEATURE(CURL_VERSION_ALTSVC)) {
+# endif
        if ((opt = php_http_option_register(registry, ZEND_STRL("altsvc_ctrl"), CURLOPT_ALTSVC_CTRL, IS_LONG))) {
                opt->setter = php_http_curle_option_set_altsvc_ctrl;
        }
        if ((opt = php_http_option_register(registry, ZEND_STRL("altsvc"), CURLOPT_ALTSVC, IS_STRING))) {
                opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR;
        }
+# if !PHP_HTTP_HAVE_LIBCURL_ALT_SVC
+       }
+# endif
 #endif
 #if PHP_HTTP_CURL_VERSION(7,74,0)
+# if !PHP_HTTP_HAVE_LIBCURL_HSTS
+       if (PHP_HTTP_CURL_FEATURE(CURL_VERSION_HSTS)) {
+# endif
        php_http_option_register(registry, ZEND_STRL("hsts_ctrl"), CURLOPT_HSTS_CTRL, IS_LONG);
        if ((opt = php_http_option_register(registry, ZEND_STRL("hsts"), CURLOPT_HSTS, IS_STRING))) {
                opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR;
        }
+# if !PHP_HTTP_HAVE_LIBCURL_HSTS
+       }
+# endif
 #endif
 }