Have cURL extension look for certificates in directory set by "openssl.capath"
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C
- Estrellas
- 40.4k
- Forks
- 8.2k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 96
Descripción
Description
I'm on Windows using openssl.cafile and a cacert.pem from curl.se . I also got a local CA certificate that I use. So far I've been just editing any new cacert.pem file to add my certificate. Been working great, but wanted to test if cURL would use openssl.capath to look for it. However, it was just ignoring even with the correct filname (<certificate hash>.0), not even making any access to the directory I set. Only using CURLOPT_CAPATH in the PHP script made it look for the certificate.
Checked out branch "PHP-8.1.22" and looked into ext/curl/interface.c and did the following:
@@ -1817,6 +1817,7 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode)
static void _php_curl_set_default_options(php_curl *ch)
{
char *cainfo;
+ char *capath;
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
@@ -1840,6 +1841,11 @@ static void _php_curl_set_default_options(php_curl *ch)
if (cainfo && cainfo[0] != '\0') {
curl_easy_setopt(ch->cp, CURLOPT_CAINFO, cainfo);
}
+
+ capath = INI_STR("openssl.capath");
+ if (capath && capath[0] != '\0') {
+ curl_easy_setopt(ch->cp, CURLOPT_CAPATH, capath);
+ }
#ifdef ZTS
curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
Compiled and tested to be working.
Could also consider adding curl.capath as a setting.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en ext/curl/interface.c, en _php_curl_set_default_options, y compara el manejo existente de openssl.cafile con el cambio propuesto para openssl.capath. Compila y prueba la extensión de cURL en Windows con un certificado con hash en el directorio configurado; se considera terminado cuando cURL usa openssl.capath sin requerir CURLOPT_CAPATH en el script de PHP.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, php
- Área
- networking, security
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100