Skip to content

Commit ce0ddf5

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 3a14ce1 commit ce0ddf5

File tree

5 files changed

+59
-1
lines changed

5 files changed

+59
-1
lines changed

ext/curl/curl.stub.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,6 +3325,13 @@
33253325
* @cvalue CURLOPT_SSL_EC_CURVES
33263326
*/
33273327
const CURLOPT_SSL_EC_CURVES = UNKNOWN;
3328+
#if LIBCURL_VERSION_NUM >= 0x080e00 /* Available since 8.14.0 */
3329+
/**
3330+
* @var int
3331+
* @cvalue CURLOPT_SSL_SIGNATURE_ALGORITHMS
3332+
*/
3333+
const CURLOPT_SSL_SIGNATURE_ALGORITHMS = UNKNOWN;
3334+
#endif
33283335
/**
33293336
* @var int
33303337
* @cvalue CURLPX_BAD_ADDRESS_TYPE

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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
var_dump(curl_error($ch));
24+
25+
var_dump(curl_setopt($ch, CURLOPT_SSL_SIGNATURE_ALGORITHMS, 'ECDSA+SHA256:RSA+SHA256:DSA+SHA256:ed25519'));
26+
var_dump(curl_exec($ch));
27+
28+
var_dump(curl_setopt($ch, CURLOPT_SSL_SIGNATURE_ALGORITHMS, null));
29+
var_dump(curl_exec($ch));
30+
31+
?>
32+
--EXPECT--
33+
string(4) "pong"
34+
bool(true)
35+
bool(false)
36+
string(52) "failed setting signature algorithms: 'invalid-value'"
37+
bool(true)
38+
string(4) "pong"
39+
bool(true)
40+
string(4) "pong"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy