Skip to content

Commit 40b4367

Browse files
committed
ext/curl: Add CURLOPT_SSL_SIGNATURE_ALGORITHMS option
Adds support for `CURLOPT_SSL_SIGNATURE_ALGORITHMS`[^1], supported since Curl version 8.14.0. [^1]: https://curl.se/libcurl/c/CURLOPT_SSL_SIGNATURE_ALGORITHMS.html
1 parent 8e46d9a commit 40b4367

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

ext/curl/curl.stub.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,14 @@
515515
const CURLFOLLOW_FIRSTONLY = UNKNOWN;
516516
#endif
517517

518+
#if LIBCURL_VERSION_NUM >= 0x080e00 /* Available since 8.14.0 */
519+
/**
520+
* @var int
521+
* @cvalue CURLOPT_SSL_SIGNATURE_ALGORITHMS
522+
*/
523+
const CURLOPT_SSL_SIGNATURE_ALGORITHMS = UNKNOWN;
524+
#endif
525+
518526
/**
519527
* @var int
520528
* @cvalue CURLINFO_TEXT

ext/curl/curl_arginfo.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/curl/interface.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,6 +2000,9 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
20002000
case CURLOPT_USERPWD:
20012001
case CURLOPT_USERNAME:
20022002
case CURLOPT_PASSWORD:
2003+
#if LIBCURL_VERSION_NUM >= 0x080e00 /* Available since 8.14.0 */
2004+
case CURLOPT_SSL_SIGNATURE_ALGORITHMS:
2005+
#endif
20032006
{
20042007
if (Z_ISNULL_P(zvalue)) {
20052008
error = curl_easy_setopt(ch->cp, option, NULL);

ext/curl/tests/Caddyfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ basic_auth /http-basic-auth {
2121
# bcrypt password hash for "password", calculated with 'caddy hash-password'
2222
user $2a$14$yUKl9SGqVTAAqPTzLup.DefsbXXx3kfreNnzpJOUHcIrKnr5lgef2
2323
}
24+
25+
route /ping {
26+
templates
27+
respond `pong`
28+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Curl option CURLOPT_SSL_SIGNATURE_ALGORITHMS
3+
--EXTENSIONS--
4+
curl
5+
--SKIPIF--
6+
<?php
7+
$curl_version = curl_version();
8+
if ($curl_version['version_number'] < 0x080e00) die("skip: test works only with curl >= 8.14.0");
9+
10+
include 'skipif-nocaddy.inc';
11+
?>
12+
--FILE--
13+
<?php
14+
15+
$ch = curl_init('https://localhost/ping');
16+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
17+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
18+
19+
var_dump(curl_exec($ch));
20+
21+
var_dump(curl_setopt($ch, CURLOPT_SSL_SIGNATURE_ALGORITHMS, 'invalid-value'));
22+
var_dump(curl_exec($ch));
23+
24+
var_dump(curl_setopt($ch, CURLOPT_SSL_SIGNATURE_ALGORITHMS, null));
25+
var_dump(curl_exec($ch));
26+
27+
?>
28+
--EXPECT--
29+
string(4) "pong"
30+
bool(true)
31+
bool(false)
32+
bool(true)
33+
string(4) "pong"

0 commit comments

Comments
 (0)