]> git.m6w6.name Git - m6w6/ext-http/commitdiff
curl: CURLOPT_TLSAUTH_TYPE never accepted enum CURL_TLSAUTH :facepalm:
authorMichael Wallner <mike@php.net>
Wed, 24 May 2023 16:26:55 +0000 (18:26 +0200)
committerMichael Wallner <mike@php.net>
Thu, 25 May 2023 11:04:10 +0000 (13:04 +0200)
autoconf/pecl/libcurl.m4
scripts/gen_github_workflow_curl-matrix.php
src/php_http_client_curl.c

index 8de9499e0eaef8351c9a397a1a9e2051f66ee008..f630b060e8cd581c0527f04d656a9baaef19fb3b 100644 (file)
@@ -126,38 +126,22 @@ AC_DEFUN([PECL_HAVE_LIBCURL_SSL], [dnl
                        ;;
                esac
 
-               PECL_HAVE_CONST([curl/curl.h], [CURLOPT_TLSAUTH_TYPE], int, [
-                       AC_CACHE_CHECK([whether CURLOPT_TLSAUTH_TYPE expects CURL_TLSAUTH_SRP], PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP]), [
-                               PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=
+               PECL_HAVE_CONST([curl/curl.h], [CURL_VERSION_TLSAUTH_SRP], int, [
+                       AC_CACHE_CHECK([for CURLOPT_TLSAUTH_TYPE SRP support], PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP]), [
+                               PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=no
                                AC_TRY_RUN([
                                        #include <curl/curl.h>
                                        int main(int argc, char *argv[]) {
-                                               CURL *ch = curl_easy_init();
-                                               return curl_easy_setopt(ch, CURLOPT_TLSAUTH_TYPE, CURL_TLSAUTH_SRP);
+                                               int has_feature = curl_version_info(CURLVERSION_NOW)->features & CURL_VERSION_TLSAUTH_SRP;
+                                               int set_failure = curl_easy_setopt(curl_easy_init(), CURLOPT_TLSAUTH_TYPE, "SRP"");
+                                               return !has_feature || set_failure;
                                        }
                                ], [
                                        PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=yes
-                               ], [
-                                       AC_TRY_RUN([
-                                               #include <curl/curl.h>
-                                               int main(int argc, char *argv[]) {
-                                                       CURL *ch = curl_easy_init();
-                                                       return curl_easy_setopt(ch, CURLOPT_TLSAUTH_TYPE, "SRP");
-                                               }
-                                       ], [
-                                               PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=no
-                                       ])
                                ])
                        ])
-                       if test -n "$PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])"; then
+                       if test "$PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])" = "yes"; then
                                PECL_DEFINE([HAVE_LIBCURL_TLSAUTH_TYPE])
-                               if $PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP]); then
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_SRP], [CURL_TLSAUTH_SRP])
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_DEF], [CURL_TLSAUTH_NONE])
-                               else
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_SRP], ["SRP"])
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_DEF], [""])
-                               fi
                        fi
                ])
 
index be6748b033a082b943e56e64c419995ca9c8c258..beaa65df633a26609cf7feae234824189825aeba 100755 (executable)
@@ -83,7 +83,7 @@ foreach ($job as $id => $env) {
           sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool
           cd curl
           ./buildconf
-          ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2
+          ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 --disable-ldap
           make -j2
           make install
       - name: Prepare
index 46502bad1eb9b532b67e9cd12400c5bfad7be412..156c569ec1393b586a4fc76d8c61e2dfc3570122 100644 (file)
@@ -1202,8 +1202,10 @@ static ZEND_RESULT_CODE php_http_curle_option_set_ssl_tlsauthtype(php_http_optio
 
        if (val && Z_LVAL_P(val)) {
                switch (Z_LVAL_P(val)) {
+               case CURL_TLSAUTH_NONE:
+                       break;
                case CURL_TLSAUTH_SRP:
-                       if (CURLE_OK == curl_easy_setopt(ch, opt->option, PHP_HTTP_LIBCURL_TLSAUTH_SRP)) {
+                       if (CURLE_OK == curl_easy_setopt(ch, opt->option, "SRP")) {
                                return SUCCESS;
                        }
                        /* no break */
@@ -1211,7 +1213,7 @@ static ZEND_RESULT_CODE php_http_curle_option_set_ssl_tlsauthtype(php_http_optio
                        return FAILURE;
                }
        }
-       if (CURLE_OK != curl_easy_setopt(ch, opt->option, PHP_HTTP_LIBCURL_TLSAUTH_DEF)) {
+       if (CURLE_OK != curl_easy_setopt(ch, opt->option, "NONE")) {
                return FAILURE;
        }
        return SUCCESS;