Skip to content

Commit 7b6fae6

Browse files
authored
Fix windows ssl bug for curl (#674)
1 parent d0a66ab commit 7b6fae6

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

Diff for: config/lib.json

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
"zlib"
7979
],
8080
"lib-depends-windows": [
81-
"openssl",
8281
"zlib",
8382
"libssh2",
8483
"nghttp2"

Diff for: src/SPC/ConsoleApplication.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
final class ConsoleApplication extends Application
3434
{
35-
public const VERSION = '2.5.0';
35+
public const VERSION = '2.5.1';
3636

3737
public function __construct()
3838
{

Diff for: src/SPC/builder/windows/library/curl.php

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ protected function build(): void
3737
'-DBUILD_EXAMPLES=OFF ' . // disable examples
3838
'-DUSE_LIBIDN2=OFF ' . // disable libidn2
3939
'-DCURL_USE_LIBPSL=OFF ' . // disable libpsl
40+
'-DCURL_USE_SCHANNEL=ON ' . // use Schannel instead of OpenSSL
41+
'-DCURL_USE_OPENSSL=OFF ' . // disable openssl due to certificate issue
4042
'-DCURL_ENABLE_SSL=ON ' .
4143
'-DUSE_NGHTTP2=ON ' . // enable nghttp2
4244
'-DCURL_USE_LIBSSH2=ON ' . // enable libssh2

Diff for: src/globals/ext-tests/curl.php

+13
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,16 @@
33
declare(strict_types=1);
44

55
assert(function_exists('curl_init'));
6+
assert(function_exists('curl_setopt'));
7+
assert(function_exists('curl_exec'));
8+
assert(function_exists('curl_close'));
9+
$curl_version = curl_version();
10+
if (stripos($curl_version['ssl_version'], 'schannel') !== false) {
11+
$curl = curl_init();
12+
curl_setopt($curl, CURLOPT_URL, 'https://example.com/');
13+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
14+
curl_setopt($curl, CURLOPT_HEADER, 0);
15+
$data = curl_exec($curl);
16+
curl_close($curl);
17+
assert($data !== false);
18+
}

Diff for: src/globals/test-extensions.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
// test os (macos-13, macos-14, ubuntu-latest, windows-latest are available)
2323
$test_os = [
24-
'macos-13',
25-
'macos-14',
24+
// 'macos-13',
25+
// 'macos-14',
2626
'ubuntu-latest',
27-
// 'windows-latest',
27+
'windows-latest',
2828
];
2929

3030
// whether enable thread safe
@@ -41,20 +41,20 @@
4141
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4242
$extensions = match (PHP_OS_FAMILY) {
4343
'Linux', 'Darwin' => '',
44-
'Windows' => 'bz2,ctype,curl,dom,filter,gd,iconv,mbstring,opcache,openssl,pdo,pdo_sqlite,phar,session,simplexml,sqlite3,tokenizer,xml,xmlwriter,yaml,zip,zlib',
44+
'Windows' => 'mbstring,tokenizer,phar,curl,openssl',
4545
};
4646

4747
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
4848
$with_libs = match (PHP_OS_FAMILY) {
49-
'Linux', 'Darwin' => 'mimalloc',
50-
'Windows' => 'libjpeg,libavif,freetype,libwebp',
49+
'Linux', 'Darwin' => '',
50+
'Windows' => '',
5151
};
5252

5353
// Please change your test base combination. We recommend testing with `common`.
5454
// You can use `common`, `bulk`, `minimal` or `none`.
5555
// note: combination is only available for *nix platform. Windows must use `none` combination
5656
$base_combination = match (PHP_OS_FAMILY) {
57-
'Linux', 'Darwin' => 'bulk',
57+
'Linux', 'Darwin' => 'minimal',
5858
'Windows' => 'none',
5959
};
6060

0 commit comments

Comments
 (0)