1 |
commit: 0ad85af662930ce594c408c15893327641d2141d |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 28 01:55:16 2021 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 28 01:56:25 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ad85af6 |
7 |
|
8 |
dev-php/pecl-http: Fix respecting flags using backported patch |
9 |
|
10 |
Closes: https://bugs.gentoo.org/791013 |
11 |
Signed-off-by: Brian Evans <grknight <AT> gentoo.org> |
12 |
|
13 |
.../files/pecl-http-3.2.4-curl-cookies.patch | 243 ++++++++++++++++++++- |
14 |
1 file changed, 237 insertions(+), 6 deletions(-) |
15 |
|
16 |
diff --git a/dev-php/pecl-http/files/pecl-http-3.2.4-curl-cookies.patch b/dev-php/pecl-http/files/pecl-http-3.2.4-curl-cookies.patch |
17 |
index 3c124b4624a..2f3a7c73a24 100644 |
18 |
--- a/dev-php/pecl-http/files/pecl-http-3.2.4-curl-cookies.patch |
19 |
+++ b/dev-php/pecl-http/files/pecl-http-3.2.4-curl-cookies.patch |
20 |
@@ -1,11 +1,242 @@ |
21 |
---- a/src/php_http_client_curl.c 2021-01-13 10:34:34.000000000 -0500 |
22 |
-+++ b/src/php_http_client_curl.c 2021-09-22 10:38:58.854615743 -0400 |
23 |
-@@ -834,7 +834,7 @@ |
24 |
+diff --git a/autoconf/pecl/libbrotli.m4 b/autoconf/pecl/libbrotli.m4 |
25 |
+index f8916e2..575f635 100644 |
26 |
+--- a/autoconf/pecl/libbrotli.m4 |
27 |
++++ b/autoconf/pecl/libbrotli.m4 |
28 |
+@@ -1,5 +1,11 @@ |
29 |
+ |
30 |
+ AC_DEFUN([PECL_CHECK_LIBBROTLI], [ |
31 |
++ dnl config.m4 calls PECL_CHECK_DONE once more |
32 |
++ PECL_COUNT_CHECKS([+1]) |
33 |
++ PECL_SAVE_ENV([CPPFLAGS], [libbrotli]) |
34 |
++ PECL_SAVE_ENV([LDFLAGS], [libbrotli]) |
35 |
++ PECL_SAVE_ENV([LIBS], [libbrotli]) |
36 |
++ |
37 |
+ PECL_CHECK_LIBBROTLI_COMMON([$1], [$2]) |
38 |
+ PECL_CHECK_DONE(libbrotlicommon, [$PECL_VAR([HAVE_LIBBROTLI_COMMON])]) |
39 |
+ PECL_CHECK_LIBBROTLI_DEC([$1], [$2]) |
40 |
+diff --git a/autoconf/pecl/libcurl.m4 b/autoconf/pecl/libcurl.m4 |
41 |
+index 4d99207..8de9499 100644 |
42 |
+--- a/autoconf/pecl/libcurl.m4 |
43 |
++++ b/autoconf/pecl/libcurl.m4 |
44 |
+@@ -160,6 +160,26 @@ AC_DEFUN([PECL_HAVE_LIBCURL_SSL], [dnl |
45 |
+ fi |
46 |
+ fi |
47 |
+ ]) |
48 |
++ |
49 |
++ PECL_HAVE_CONST([curl/curl.h], [CURL_LOCK_DATA_SSL_SESSION], int, [ |
50 |
++ AC_CACHE_CHECK([whether curl_share accepts CURL_LOCK_DATA_SSL_SESSION], PECL_CACHE_VAR([LIBCURL_SHARE_SSL]), [ |
51 |
++ PECL_CACHE_VAR([LIBCURL_SHARE_SSL])= |
52 |
++ AC_TRY_RUN([ |
53 |
++ #include <curl/curl.h> |
54 |
++ int main(int argc, char *argv[]) { |
55 |
++ CURLSH *ch = curl_share_init(); |
56 |
++ return curl_share_setopt(ch, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION); |
57 |
++ } |
58 |
++ ], [ |
59 |
++ PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=yes |
60 |
++ ], [ |
61 |
++ PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=no |
62 |
++ ]) |
63 |
++ ]) |
64 |
++ if test "$PECL_CACHE_VAR([LIBCURL_SHARE_SSL])" = yes; then |
65 |
++ PECL_DEFINE([HAVE_LIBCURL_SHARE_SSL], [1]) |
66 |
++ fi |
67 |
++ ]) |
68 |
+ ]) |
69 |
+ ]) |
70 |
+ dnl |
71 |
+diff --git a/autoconf/pecl/pecl.m4 b/autoconf/pecl/pecl.m4 |
72 |
+index ffa45ac..d8735b0 100644 |
73 |
+--- a/autoconf/pecl/pecl.m4 |
74 |
++++ b/autoconf/pecl/pecl.m4 |
75 |
+@@ -70,6 +70,12 @@ AC_DEFUN([PECL_RESTORE_ENV], [ |
76 |
+ $1=$PECL_SAVE_VAR([$2_$1]) |
77 |
+ ]) |
78 |
+ dnl |
79 |
++dnl PECL_COUNT_CHECKS(incdec) |
80 |
++dnl |
81 |
++AC_DEFUN([PECL_COUNT_CHECKS], [ |
82 |
++ PECL_VAR([_checks])=$(($PECL_VAR([_checks])$1)) |
83 |
++]) |
84 |
++dnl |
85 |
+ dnl PECL_EVAL_LIBLINE(libline) |
86 |
+ dnl |
87 |
+ AC_DEFUN([PECL_EVAL_LIBLINE], [ |
88 |
+@@ -244,6 +250,7 @@ dnl |
89 |
+ dnl PECL_CHECK_CUSTOM(name, path, header, lib, version) |
90 |
+ dnl |
91 |
+ AC_DEFUN([PECL_CHECK_CUSTOM], [ |
92 |
++ PECL_COUNT_CHECKS([+1]) |
93 |
+ PECL_SAVE_ENV([CPPFLAGS], [$1]) |
94 |
+ PECL_SAVE_ENV([LDFLAGS], [$1]) |
95 |
+ PECL_SAVE_ENV([LIBS], [$1]) |
96 |
+@@ -260,10 +267,10 @@ AC_DEFUN([PECL_CHECK_CUSTOM], [ |
97 |
+ done |
98 |
+ ]) |
99 |
+ if test -n "$PECL_CACHE_VAR([$1_prefix])"; then |
100 |
+- CPPFLAGS="-I$PECL_CACHE_VAR([$1_prefix])/include" |
101 |
+- LDFLAGS="-L$PECL_CACHE_VAR([$1_prefix])/$PHP_LIBDIR" |
102 |
+- LIBS="-l$4" |
103 |
+- PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) |
104 |
++ CPPFLAGS="$CPPFLAGS -I$PECL_CACHE_VAR([$1_prefix])/include" |
105 |
++ LDFLAGS="$LDFLAGS -L$PECL_CACHE_VAR([$1_prefix])/$PHP_LIBDIR" |
106 |
++ LIBS="$LIBS -l$4" |
107 |
++ dnl PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) |
108 |
+ |
109 |
+ AC_CACHE_VAL(PECL_CACHE_VAR([$1_version]), [ |
110 |
+ pushd $PECL_CACHE_VAR([$1_prefix]) >/dev/null |
111 |
+@@ -288,11 +295,11 @@ dnl |
112 |
+ dnl PECL_CHECK_CONFIG(name, prog-config, version-flag, cppflags-flag, ldflags-flag, libs-flag) |
113 |
+ dnl |
114 |
+ AC_DEFUN([PECL_CHECK_CONFIG], [ |
115 |
++ PECL_COUNT_CHECKS([+1]) |
116 |
+ PECL_SAVE_ENV([CPPFLAGS], [$1]) |
117 |
+ PECL_SAVE_ENV([LDFLAGS], [$1]) |
118 |
+ PECL_SAVE_ENV([LIBS], [$1]) |
119 |
+ |
120 |
+- |
121 |
+ AC_MSG_CHECKING([for $1]) |
122 |
+ ifelse($2, [$PKG_CONFIG $1], [ |
123 |
+ AC_CACHE_VAL(PECL_CACHE_VAR([$1_exists]), [ |
124 |
+@@ -311,20 +318,22 @@ AC_DEFUN([PECL_CHECK_CONFIG], [ |
125 |
+ AC_CACHE_VAL(PECL_CACHE_VAR([$1_cppflags]), [ |
126 |
+ PECL_CACHE_VAR([$1_cppflags])=$($2 $4) |
127 |
+ ]) |
128 |
+- CPPFLAGS=$PECL_CACHE_VAR([$1_cppflags]) |
129 |
++ CPPFLAGS="$CPPFLAGS $PECL_CACHE_VAR([$1_cppflags])" |
130 |
+ AC_CACHE_VAL(PECL_CACHE_VAR([$1_ldflags]), [ |
131 |
+ PECL_CACHE_VAR([$1_ldflags])=$($2 $5) |
132 |
+ ]) |
133 |
+- LDFLAGS=$PECL_CACHE_VAR([$1_ldflags]) |
134 |
++ LDFLAGS="$LDFLAGS $PECL_CACHE_VAR([$1_ldflags])" |
135 |
+ AC_CACHE_VAL(PECL_CACHE_VAR([$1_libs]), [ |
136 |
+ PECL_CACHE_VAR([$1_libs])=$($2 $6) |
137 |
+ ]) |
138 |
+- LIBS=$PECL_CACHE_VAR([$1_libs]) |
139 |
+- PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) |
140 |
++ LIBS="$LIBS $PECL_CACHE_VAR([$1_libs])" |
141 |
++ dnl PECL_EVAL_LIBLINE([$LDFLAGS $LIBS]) |
142 |
+ ifelse($2, [$PKG_CONFIG $1], [ |
143 |
+ fi |
144 |
+ ]) |
145 |
+ |
146 |
++ AC_MSG_RESULT([${PECL_CHECKED_VERSION([$1]):-no}]) |
147 |
++ |
148 |
+ if test -n "$PECL_CHECKED_VERSION([$1])"; then |
149 |
+ PECL_VAR([HAVE_$1])=true |
150 |
+ PECL_DEFINE([HAVE_$1]) |
151 |
+@@ -332,8 +341,6 @@ AC_DEFUN([PECL_CHECK_CONFIG], [ |
152 |
+ else |
153 |
+ PECL_VAR([HAVE_$1])=false |
154 |
+ fi |
155 |
+- |
156 |
+- AC_MSG_RESULT([${PECL_CHECKED_VERSION([$1]):-no}]) |
157 |
+ ]) |
158 |
+ dnl |
159 |
+ dnl PECL_CHECK_PKGCONFIG(pkg[, additional-pkg-config-path]) |
160 |
+@@ -355,9 +362,25 @@ dnl |
161 |
+ dnl PECL_CHECK_DONE(name, success[, incline, libline]) |
162 |
+ dnl |
163 |
+ AC_DEFUN([PECL_CHECK_DONE], [ |
164 |
+- if $2; then |
165 |
+- incline=$CPPFLAGS |
166 |
+- libline="$LDFLAGS $LIBS" |
167 |
++ PECL_COUNT_CHECKS([-1]) |
168 |
++ success=$2 |
169 |
++ if $success && test -n "$LDFLAGS$LIBS"; then |
170 |
++ AC_MSG_CHECKING([whether $1 can be linked]) |
171 |
++ AC_TRY_LINK([], [], [success=yes], [success=no]) |
172 |
++ AC_MSG_RESULT([$success]) |
173 |
++ if ! $success; then |
174 |
++ AC_MSG_WARN([$1 was found, but fails to link with:]) |
175 |
++ AC_MSG_WARN([ LDFLAGS='$LDFLAGS']) |
176 |
++ AC_MSG_WARN([ LIBS='$LIBS']) |
177 |
++ AC_MSG_WARN([Missing or updated library paths?]) |
178 |
++ fi |
179 |
++ fi |
180 |
++ if $success; then |
181 |
++ _cppflags=$PECL_SAVE_VAR([$1_CPPFLAGS]) |
182 |
++ _ldflags=$PECL_SAVE_VAR([$1_LDFLAGS]) |
183 |
++ _libs=$PECL_SAVE_VAR([$1_LIBS]) |
184 |
++ incline=${CPPFLAGS:${#_cppflags}} |
185 |
++ libline=["${LDFLAGS:${#_ldflags}} ${LIBS:${#_libs}}"] |
186 |
+ PECL_DEFINE([HAVE_$1]) |
187 |
+ else |
188 |
+ incline=$3 |
189 |
+diff --git a/config9.m4 b/config9.m4 |
190 |
+index ef7d33e..695701b 100644 |
191 |
+--- a/config9.m4 |
192 |
++++ b/config9.m4 |
193 |
+@@ -24,6 +24,8 @@ if test "$PHP_HTTP" != "no"; then |
194 |
+ AC_CHECK_LIB(nsl, getdomainname) |
195 |
+ ]) |
196 |
+ AC_CHECK_FUNCS(mbrtowc mbtowc iswalnum inet_pton) |
197 |
++ |
198 |
++ CFLAGS="$CFLAGS -Wno-strict-prototypes" |
199 |
+ |
200 |
+ dnl ZLIB |
201 |
+ PHP_ARG_WITH([http-zlib-dir], [whether/where to check for zlib], |
202 |
+diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c |
203 |
+index 0e79f19..8898b5d 100644 |
204 |
+--- a/src/php_http_client_curl.c |
205 |
++++ b/src/php_http_client_curl.c |
206 |
+@@ -17,6 +17,8 @@ |
207 |
+ |
208 |
+ #if PHP_HTTP_HAVE_LIBCURL |
209 |
+ |
210 |
++#define DEBUG_COOKIES 0 |
211 |
++ |
212 |
+ #if PHP_HTTP_HAVE_LIBCURL_OPENSSL |
213 |
+ # include <openssl/ssl.h> |
214 |
+ #endif |
215 |
+@@ -834,6 +836,9 @@ static ZEND_RESULT_CODE php_http_curle_option_set_cookiesession(php_http_option_ |
216 |
+ return FAILURE; |
217 |
+ } |
218 |
+ if (Z_TYPE_P(val) == IS_TRUE) { |
219 |
++#if DEBUG_COOKIES |
220 |
++ fprintf(stderr, "CURLOPT_COOKIELIST: SESS\n"); |
221 |
++#endif |
222 |
+ if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIELIST, "SESS")) { |
223 |
+ return FAILURE; |
224 |
+ } |
225 |
+@@ -856,9 +861,19 @@ static ZEND_RESULT_CODE php_http_curle_option_set_cookiestore(php_http_option_t |
226 |
} else { |
227 |
storage->cookiestore = NULL; |
228 |
} |
229 |
- if ( CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore) |
230 |
-+ if ( CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore ? storage->cookiestore : "") |
231 |
- || CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore) |
232 |
- ) { |
233 |
+- || CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore) |
234 |
+- ) { |
235 |
++ |
236 |
++#if DEBUG_COOKIES |
237 |
++ fprintf(stderr, "CURLOPT_COOKIEFILE: %s\n", cookiestore); |
238 |
++#endif |
239 |
++ // does NOT enable ch->data.cookies until transfer; adds to ch->stsate.cookielist |
240 |
++ if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore ? storage->cookiestore : "")) { |
241 |
++ return FAILURE; |
242 |
++ } |
243 |
++#if DEBUG_COOKIES |
244 |
++ fprintf(stderr, "CURLOPT_COOKIEJAR: %s\n", cookiestore); |
245 |
++#endif |
246 |
++ // enables ch->data.cookies |
247 |
++ if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore)) { |
248 |
return FAILURE; |
249 |
+ } |
250 |
+ |
251 |
+@@ -1919,7 +1934,7 @@ static ZEND_RESULT_CODE php_http_curlm_option_set_share_cookies(php_http_option_ |
252 |
+ return SUCCESS; |
253 |
+ } |
254 |
+ |
255 |
+-#if PHP_HTTP_CURL_VERSION(7,23,0) |
256 |
++#if PHP_HTTP_HAVE_LIBCURL_SHARE_SSL |
257 |
+ static ZEND_RESULT_CODE php_http_curlm_option_set_share_ssl(php_http_option_t *opt, zval *value, void *userdata) |
258 |
+ { |
259 |
+ php_http_client_t *client = userdata; |
260 |
+@@ -1994,7 +2009,7 @@ static void php_http_curlm_options_init(php_http_options_t *registry) |
261 |
+ opt->setter = php_http_curlm_option_set_share_cookies; |
262 |
+ ZVAL_TRUE(&opt->defval); |
263 |
+ } |
264 |
+-#if PHP_HTTP_CURL_VERSION(7,23,0) |
265 |
++#if PHP_HTTP_HAVE_LIBCURL_SHARE_SSL |
266 |
+ if ((opt = php_http_option_register(registry, ZEND_STRL("share_ssl"), 0, _IS_BOOL))) { |
267 |
+ opt->setter = php_http_curlm_option_set_share_ssl; |
268 |
+ ZVAL_TRUE(&opt->defval); |