File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,13 @@ if ($curl_version['version_number'] < 0x074700) {
1818--FILE--
1919<?php
2020
21- function check_error (CurlHandle $ ch ) {
21+ function check_error (CurlHandle $ ch, $ expected = null ) {
2222 if (curl_errno ($ ch ) !== 0 ) {
23- echo "CURL ERROR: " . curl_errno ($ ch ) . "\n" ;
23+ $ errno = curl_errno ($ ch );
24+ if (!is_null ($ expected )) {
25+ $ errno = $ errno == $ expected ? 'EXPECTED ' : "UNEXPECTED(A: $ errno,E: $ expected) " ;
26+ }
27+ echo "CURL ERROR: " . $ errno . "\n" ;
2428 }
2529}
2630
@@ -109,7 +113,7 @@ try {
109113
110114 $ response = curl_exec ($ ch );
111115 check_response ($ response , $ clientCertSubject );
112- check_error ($ ch );
116+ check_error ($ ch, curl_version ()[ ' version_number ' ] < 0x081000 ? 58 : 43 );
113117 curl_close ($ ch );
114118
115119 echo "\n" ;
@@ -203,7 +207,7 @@ bool(true)
203207bool(true)
204208bool(true)
205209client cert subject not in response
206- CURL ERROR: 58
210+ CURL ERROR: EXPECTED
207211
208212case 4: client cert and key from file
209213bool(true)
You can’t perform that action at this time.
0 commit comments