You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
243 lines
7.6 KiB
243 lines
7.6 KiB
diff --git a/autoconf/pecl/libbrotli.m4 b/autoconf/pecl/libbrotli.m4
|
|
index f8916e2..575f635 100644
|
|
--- a/autoconf/pecl/libbrotli.m4
|
|
+++ b/autoconf/pecl/libbrotli.m4
|
|
@@ -1,5 +1,11 @@
|
|
|
|
AC_DEFUN([PECL_CHECK_LIBBROTLI], [
|
|
+ dnl config.m4 calls PECL_CHECK_DONE once more
|
|
+ PECL_COUNT_CHECKS([+1])
|
|
+ PECL_SAVE_ENV([CPPFLAGS], [libbrotli])
|
|
+ PECL_SAVE_ENV([LDFLAGS], [libbrotli])
|
|
+ PECL_SAVE_ENV([LIBS], [libbrotli])
|
|
+
|
|
PECL_CHECK_LIBBROTLI_COMMON([$1], [$2])
|
|
PECL_CHECK_DONE(libbrotlicommon, [$PECL_VAR([HAVE_LIBBROTLI_COMMON])])
|
|
PECL_CHECK_LIBBROTLI_DEC([$1], [$2])
|
|
diff --git a/autoconf/pecl/libcurl.m4 b/autoconf/pecl/libcurl.m4
|
|
index 4d99207..8de9499 100644
|
|
--- a/autoconf/pecl/libcurl.m4
|
|
+++ b/autoconf/pecl/libcurl.m4
|
|
@@ -160,6 +160,26 @@ AC_DEFUN([PECL_HAVE_LIBCURL_SSL], [dnl
|
|
fi
|
|
fi
|
|
])
|
|
+
|
|
+ PECL_HAVE_CONST([curl/curl.h], [CURL_LOCK_DATA_SSL_SESSION], int, [
|
|
+ AC_CACHE_CHECK([whether curl_share accepts CURL_LOCK_DATA_SSL_SESSION], PECL_CACHE_VAR([LIBCURL_SHARE_SSL]), [
|
|
+ PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=
|
|
+ AC_TRY_RUN([
|
|
+ #include <curl/curl.h>
|
|
+ int main(int argc, char *argv[]) {
|
|
+ CURLSH *ch = curl_share_init();
|
|
+ return curl_share_setopt(ch, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
|
+ }
|
|
+ ], [
|
|
+ PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=yes
|
|
+ ], [
|
|
+ PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=no
|
|
+ ])
|
|
+ ])
|
|
+ if test "$PECL_CACHE_VAR([LIBCURL_SHARE_SSL])" = yes; then
|
|
+ PECL_DEFINE([HAVE_LIBCURL_SHARE_SSL], [1])
|
|
+ fi
|
|
+ ])
|
|
])
|
|
])
|
|
dnl
|
|
diff --git a/autoconf/pecl/pecl.m4 b/autoconf/pecl/pecl.m4
|
|
index ffa45ac..d8735b0 100644
|
|
--- a/autoconf/pecl/pecl.m4
|
|
+++ b/autoconf/pecl/pecl.m4
|
|
@@ -70,6 +70,12 @@ AC_DEFUN([PECL_RESTORE_ENV], [
|
|
$1=$PECL_SAVE_VAR([$2_$1])
|
|
])
|
|
dnl
|
|
+dnl PECL_COUNT_CHECKS(incdec)
|
|
+dnl
|
|
+AC_DEFUN([PECL_COUNT_CHECKS], [
|
|
+ PECL_VAR([_checks])=$(($PECL_VAR([_checks])$1))
|
|
+])
|
|
+dnl
|
|
dnl PECL_EVAL_LIBLINE(libline)
|
|
dnl
|
|
AC_DEFUN([PECL_EVAL_LIBLINE], [
|
|
@@ -244,6 +250,7 @@ dnl
|
|
dnl PECL_CHECK_CUSTOM(name, path, header, lib, version)
|
|
dnl
|
|
AC_DEFUN([PECL_CHECK_CUSTOM], [
|
|
+ PECL_COUNT_CHECKS([+1])
|
|
PECL_SAVE_ENV([CPPFLAGS], [$1])
|
|
PECL_SAVE_ENV([LDFLAGS], [$1])
|
|
PECL_SAVE_ENV([LIBS], [$1])
|
|
@@ -260,10 +267,10 @@ AC_DEFUN([PECL_CHECK_CUSTOM], [
|
|
done
|
|
])
|
|
if test -n "$PECL_CACHE_VAR([$1_prefix])"; then
|
|
- CPPFLAGS="-I$PECL_CACHE_VAR([$1_prefix])/include"
|
|
- LDFLAGS="-L$PECL_CACHE_VAR([$1_prefix])/$PHP_LIBDIR"
|
|
- LIBS="-l$4"
|
|
- PECL_EVAL_LIBLINE([$LDFLAGS $LIBS])
|
|
+ CPPFLAGS="$CPPFLAGS -I$PECL_CACHE_VAR([$1_prefix])/include"
|
|
+ LDFLAGS="$LDFLAGS -L$PECL_CACHE_VAR([$1_prefix])/$PHP_LIBDIR"
|
|
+ LIBS="$LIBS -l$4"
|
|
+ dnl PECL_EVAL_LIBLINE([$LDFLAGS $LIBS])
|
|
|
|
AC_CACHE_VAL(PECL_CACHE_VAR([$1_version]), [
|
|
pushd $PECL_CACHE_VAR([$1_prefix]) >/dev/null
|
|
@@ -288,11 +295,11 @@ dnl
|
|
dnl PECL_CHECK_CONFIG(name, prog-config, version-flag, cppflags-flag, ldflags-flag, libs-flag)
|
|
dnl
|
|
AC_DEFUN([PECL_CHECK_CONFIG], [
|
|
+ PECL_COUNT_CHECKS([+1])
|
|
PECL_SAVE_ENV([CPPFLAGS], [$1])
|
|
PECL_SAVE_ENV([LDFLAGS], [$1])
|
|
PECL_SAVE_ENV([LIBS], [$1])
|
|
|
|
-
|
|
AC_MSG_CHECKING([for $1])
|
|
ifelse($2, [$PKG_CONFIG $1], [
|
|
AC_CACHE_VAL(PECL_CACHE_VAR([$1_exists]), [
|
|
@@ -311,20 +318,22 @@ AC_DEFUN([PECL_CHECK_CONFIG], [
|
|
AC_CACHE_VAL(PECL_CACHE_VAR([$1_cppflags]), [
|
|
PECL_CACHE_VAR([$1_cppflags])=$($2 $4)
|
|
])
|
|
- CPPFLAGS=$PECL_CACHE_VAR([$1_cppflags])
|
|
+ CPPFLAGS="$CPPFLAGS $PECL_CACHE_VAR([$1_cppflags])"
|
|
AC_CACHE_VAL(PECL_CACHE_VAR([$1_ldflags]), [
|
|
PECL_CACHE_VAR([$1_ldflags])=$($2 $5)
|
|
])
|
|
- LDFLAGS=$PECL_CACHE_VAR([$1_ldflags])
|
|
+ LDFLAGS="$LDFLAGS $PECL_CACHE_VAR([$1_ldflags])"
|
|
AC_CACHE_VAL(PECL_CACHE_VAR([$1_libs]), [
|
|
PECL_CACHE_VAR([$1_libs])=$($2 $6)
|
|
])
|
|
- LIBS=$PECL_CACHE_VAR([$1_libs])
|
|
- PECL_EVAL_LIBLINE([$LDFLAGS $LIBS])
|
|
+ LIBS="$LIBS $PECL_CACHE_VAR([$1_libs])"
|
|
+ dnl PECL_EVAL_LIBLINE([$LDFLAGS $LIBS])
|
|
ifelse($2, [$PKG_CONFIG $1], [
|
|
fi
|
|
])
|
|
|
|
+ AC_MSG_RESULT([${PECL_CHECKED_VERSION([$1]):-no}])
|
|
+
|
|
if test -n "$PECL_CHECKED_VERSION([$1])"; then
|
|
PECL_VAR([HAVE_$1])=true
|
|
PECL_DEFINE([HAVE_$1])
|
|
@@ -332,8 +341,6 @@ AC_DEFUN([PECL_CHECK_CONFIG], [
|
|
else
|
|
PECL_VAR([HAVE_$1])=false
|
|
fi
|
|
-
|
|
- AC_MSG_RESULT([${PECL_CHECKED_VERSION([$1]):-no}])
|
|
])
|
|
dnl
|
|
dnl PECL_CHECK_PKGCONFIG(pkg[, additional-pkg-config-path])
|
|
@@ -355,9 +362,25 @@ dnl
|
|
dnl PECL_CHECK_DONE(name, success[, incline, libline])
|
|
dnl
|
|
AC_DEFUN([PECL_CHECK_DONE], [
|
|
- if $2; then
|
|
- incline=$CPPFLAGS
|
|
- libline="$LDFLAGS $LIBS"
|
|
+ PECL_COUNT_CHECKS([-1])
|
|
+ success=$2
|
|
+ if $success && test -n "$LDFLAGS$LIBS"; then
|
|
+ AC_MSG_CHECKING([whether $1 can be linked])
|
|
+ AC_TRY_LINK([], [], [success=yes], [success=no])
|
|
+ AC_MSG_RESULT([$success])
|
|
+ if ! $success; then
|
|
+ AC_MSG_WARN([$1 was found, but fails to link with:])
|
|
+ AC_MSG_WARN([ LDFLAGS='$LDFLAGS'])
|
|
+ AC_MSG_WARN([ LIBS='$LIBS'])
|
|
+ AC_MSG_WARN([Missing or updated library paths?])
|
|
+ fi
|
|
+ fi
|
|
+ if $success; then
|
|
+ _cppflags=$PECL_SAVE_VAR([$1_CPPFLAGS])
|
|
+ _ldflags=$PECL_SAVE_VAR([$1_LDFLAGS])
|
|
+ _libs=$PECL_SAVE_VAR([$1_LIBS])
|
|
+ incline=${CPPFLAGS:${#_cppflags}}
|
|
+ libline=["${LDFLAGS:${#_ldflags}} ${LIBS:${#_libs}}"]
|
|
PECL_DEFINE([HAVE_$1])
|
|
else
|
|
incline=$3
|
|
diff --git a/config9.m4 b/config9.m4
|
|
index ef7d33e..695701b 100644
|
|
--- a/config9.m4
|
|
+++ b/config9.m4
|
|
@@ -24,6 +24,8 @@ if test "$PHP_HTTP" != "no"; then
|
|
AC_CHECK_LIB(nsl, getdomainname)
|
|
])
|
|
AC_CHECK_FUNCS(mbrtowc mbtowc iswalnum inet_pton)
|
|
+
|
|
+ CFLAGS="$CFLAGS -Wno-strict-prototypes"
|
|
|
|
dnl ZLIB
|
|
PHP_ARG_WITH([http-zlib-dir], [whether/where to check for zlib],
|
|
diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c
|
|
index 0e79f19..8898b5d 100644
|
|
--- a/src/php_http_client_curl.c
|
|
+++ b/src/php_http_client_curl.c
|
|
@@ -17,6 +17,8 @@
|
|
|
|
#if PHP_HTTP_HAVE_LIBCURL
|
|
|
|
+#define DEBUG_COOKIES 0
|
|
+
|
|
#if PHP_HTTP_HAVE_LIBCURL_OPENSSL
|
|
# include <openssl/ssl.h>
|
|
#endif
|
|
@@ -834,6 +836,9 @@ static ZEND_RESULT_CODE php_http_curle_option_set_cookiesession(php_http_option_
|
|
return FAILURE;
|
|
}
|
|
if (Z_TYPE_P(val) == IS_TRUE) {
|
|
+#if DEBUG_COOKIES
|
|
+ fprintf(stderr, "CURLOPT_COOKIELIST: SESS\n");
|
|
+#endif
|
|
if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIELIST, "SESS")) {
|
|
return FAILURE;
|
|
}
|
|
@@ -856,9 +861,19 @@ static ZEND_RESULT_CODE php_http_curle_option_set_cookiestore(php_http_option_t
|
|
} else {
|
|
storage->cookiestore = NULL;
|
|
}
|
|
- if ( CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore)
|
|
- || CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore)
|
|
- ) {
|
|
+
|
|
+#if DEBUG_COOKIES
|
|
+ fprintf(stderr, "CURLOPT_COOKIEFILE: %s\n", cookiestore);
|
|
+#endif
|
|
+ // does NOT enable ch->data.cookies until transfer; adds to ch->stsate.cookielist
|
|
+ if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore ? storage->cookiestore : "")) {
|
|
+ return FAILURE;
|
|
+ }
|
|
+#if DEBUG_COOKIES
|
|
+ fprintf(stderr, "CURLOPT_COOKIEJAR: %s\n", cookiestore);
|
|
+#endif
|
|
+ // enables ch->data.cookies
|
|
+ if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore)) {
|
|
return FAILURE;
|
|
}
|
|
|
|
@@ -1919,7 +1934,7 @@ static ZEND_RESULT_CODE php_http_curlm_option_set_share_cookies(php_http_option_
|
|
return SUCCESS;
|
|
}
|
|
|
|
-#if PHP_HTTP_CURL_VERSION(7,23,0)
|
|
+#if PHP_HTTP_HAVE_LIBCURL_SHARE_SSL
|
|
static ZEND_RESULT_CODE php_http_curlm_option_set_share_ssl(php_http_option_t *opt, zval *value, void *userdata)
|
|
{
|
|
php_http_client_t *client = userdata;
|
|
@@ -1994,7 +2009,7 @@ static void php_http_curlm_options_init(php_http_options_t *registry)
|
|
opt->setter = php_http_curlm_option_set_share_cookies;
|
|
ZVAL_TRUE(&opt->defval);
|
|
}
|
|
-#if PHP_HTTP_CURL_VERSION(7,23,0)
|
|
+#if PHP_HTTP_HAVE_LIBCURL_SHARE_SSL
|
|
if ((opt = php_http_option_register(registry, ZEND_STRL("share_ssl"), 0, _IS_BOOL))) {
|
|
opt->setter = php_http_curlm_option_set_share_ssl;
|
|
ZVAL_TRUE(&opt->defval);
|