mirror of
https://github.com/curl/curl.git
synced 2026-08-24 20:43:47 +03:00
tidy-up: Markdown, clang-format nits
- drop leading indent from Markdown. - switch to Markdown section markers where missing. - move `&&` and `||` to the end of the line (C, Perl). - openssl: add parenthesis to an if sub-expression. - misc clang-format nits. - unfold Markdown links. - SSL-PROBLEMS.md: drop stray half code-fence. Closes #20402
This commit is contained in:
parent
9e9adfddbf
commit
b81341e8f5
24 changed files with 409 additions and 468 deletions
|
|
@ -426,8 +426,8 @@ connect_sub_chain:
|
|||
#ifdef USE_SSL
|
||||
if((ctx->ssl_mode == CURL_CF_SSL_ENABLE ||
|
||||
(ctx->ssl_mode != CURL_CF_SSL_DISABLE &&
|
||||
cf->conn->scheme->flags & PROTOPT_SSL)) /* we want SSL */
|
||||
&& !Curl_conn_is_ssl(cf->conn, cf->sockindex)) { /* it is missing */
|
||||
cf->conn->scheme->flags & PROTOPT_SSL)) && /* we want SSL */
|
||||
!Curl_conn_is_ssl(cf->conn, cf->sockindex)) { /* it is missing */
|
||||
result = Curl_cf_ssl_insert_after(cf, data);
|
||||
if(result)
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -679,8 +679,8 @@ static const struct Curl_cwtype *find_unencode_writer(const char *name,
|
|||
for(cep = transfer_unencoders; *cep; cep++) {
|
||||
const struct Curl_cwtype *ce = *cep;
|
||||
if((curl_strnequal(name, ce->name, len) && !ce->name[len]) ||
|
||||
(ce->alias && curl_strnequal(name, ce->alias, len)
|
||||
&& !ce->alias[len]))
|
||||
(ce->alias && curl_strnequal(name, ce->alias, len) &&
|
||||
!ce->alias[len]))
|
||||
return ce;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ static void sasl_state(struct SASL *sasl, struct Curl_easy *data,
|
|||
{
|
||||
#if defined(DEBUGBUILD) && defined(CURLVERBOSE)
|
||||
/* for debug purposes */
|
||||
static const char * const names[]={
|
||||
static const char * const names[] = {
|
||||
"STOP",
|
||||
"PLAIN",
|
||||
"LOGIN",
|
||||
|
|
|
|||
|
|
@ -755,9 +755,9 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
|
|||
return DOH_DNS_OUT_OF_RANGE;
|
||||
|
||||
type = doh_get16bit(doh, index);
|
||||
if((type != CURL_DNS_TYPE_CNAME) /* may be synthesized from DNAME */
|
||||
&& (type != CURL_DNS_TYPE_DNAME) /* if present, accept and ignore */
|
||||
&& (type != dnstype))
|
||||
if((type != CURL_DNS_TYPE_CNAME) && /* may be synthesized from DNAME */
|
||||
(type != CURL_DNS_TYPE_DNAME) && /* if present, accept and ignore */
|
||||
(type != dnstype))
|
||||
/* Not the same type as was asked for nor CNAME nor DNAME */
|
||||
return DOH_DNS_UNEXPECTED_TYPE;
|
||||
index += 2;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include "urldata.h"
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -960,8 +960,7 @@ static CURLcode oldap_disconnect(struct Curl_easy *data,
|
|||
#ifdef USE_SSL
|
||||
if(ssl_installed(conn)) {
|
||||
Sockbuf *sb;
|
||||
if((ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS)
|
||||
||
|
||||
if(ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS ||
|
||||
ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data))
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1224,9 +1224,9 @@ static CURLcode ssh_state_pkey_init(struct Curl_easy *data,
|
|||
* libssh2 extract the public key from the private key file.
|
||||
* This is done by simply passing sshc->rsa_pub = NULL.
|
||||
*/
|
||||
if(!out_of_memory && data->set.str[STRING_SSH_PUBLIC_KEY]
|
||||
if(!out_of_memory && data->set.str[STRING_SSH_PUBLIC_KEY] &&
|
||||
/* treat empty string the same way as NULL */
|
||||
&& data->set.str[STRING_SSH_PUBLIC_KEY][0]) {
|
||||
data->set.str[STRING_SSH_PUBLIC_KEY][0]) {
|
||||
sshc->rsa_pub = curlx_strdup(data->set.str[STRING_SSH_PUBLIC_KEY]);
|
||||
if(!sshc->rsa_pub)
|
||||
out_of_memory = TRUE;
|
||||
|
|
|
|||
|
|
@ -1196,8 +1196,7 @@ static int engineload(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
/* Load the certificate from the engine */
|
||||
if(!ENGINE_ctrl_cmd(data->state.engine, cmd_name,
|
||||
0, ¶ms, NULL, 1)) {
|
||||
if(!ENGINE_ctrl_cmd(data->state.engine, cmd_name, 0, ¶ms, NULL, 1)) {
|
||||
failf(data, "ssl engine cannot load client cert with id '%s' [%s]",
|
||||
cert_file,
|
||||
ossl_strerror(ERR_get_error(), error_buffer,
|
||||
|
|
@ -1326,7 +1325,7 @@ static int pkcs12load(struct Curl_easy *data,
|
|||
if(!cert_bio) {
|
||||
failf(data, "BIO_new_mem_buf NULL, " OSSL_PACKAGE " error %s",
|
||||
ossl_strerror(ERR_get_error(), error_buffer,
|
||||
sizeof(error_buffer)) );
|
||||
sizeof(error_buffer)));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1335,7 +1334,7 @@ static int pkcs12load(struct Curl_easy *data,
|
|||
if(!cert_bio) {
|
||||
failf(data, "BIO_new return NULL, " OSSL_PACKAGE " error %s",
|
||||
ossl_strerror(ERR_get_error(), error_buffer,
|
||||
sizeof(error_buffer)) );
|
||||
sizeof(error_buffer)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2581,9 +2580,9 @@ static void ossl_trace(int direction, int ssl_ver, int content_type,
|
|||
(void)ssl;
|
||||
}
|
||||
|
||||
static CURLcode
|
||||
ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx,
|
||||
unsigned int ssl_version_min)
|
||||
static CURLcode ossl_set_ssl_version_min_max(struct Curl_cfilter *cf,
|
||||
SSL_CTX *ctx,
|
||||
unsigned int ssl_version_min)
|
||||
{
|
||||
struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf);
|
||||
/* first, TLS min version... */
|
||||
|
|
@ -2714,7 +2713,7 @@ CURLcode Curl_ossl_add_session(struct Curl_cfilter *cf,
|
|||
result = Curl_ssl_session_create2(der_session_buf, der_session_size,
|
||||
ietf_tls_id, alpn,
|
||||
(curl_off_t)time(NULL) +
|
||||
SSL_SESSION_get_timeout(session),
|
||||
SSL_SESSION_get_timeout(session),
|
||||
earlydata_max, qtp_clone, quic_tp_len,
|
||||
&sc_session);
|
||||
der_session_buf = NULL; /* took ownership of sdata */
|
||||
|
|
@ -2739,8 +2738,7 @@ static int ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid)
|
|||
struct Curl_easy *data = CF_DATA_CURRENT(cf);
|
||||
struct ssl_connect_data *connssl = cf->ctx;
|
||||
Curl_ossl_add_session(cf, data, connssl->peer.scache_key, ssl_sessionid,
|
||||
SSL_version(ssl), connssl->negotiated.alpn,
|
||||
NULL, 0);
|
||||
SSL_version(ssl), connssl->negotiated.alpn, NULL, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3131,7 +3129,7 @@ static CURLcode ossl_populate_x509_store(struct Curl_cfilter *cf,
|
|||
* revocation */
|
||||
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
|
||||
if(!lookup ||
|
||||
(!X509_load_crl_file(lookup, ssl_crlfile, X509_FILETYPE_PEM)) ) {
|
||||
(!X509_load_crl_file(lookup, ssl_crlfile, X509_FILETYPE_PEM))) {
|
||||
failf(data, "error loading CRL file: %s", ssl_crlfile);
|
||||
return CURLE_SSL_CRL_BADFILE;
|
||||
}
|
||||
|
|
@ -3977,8 +3975,8 @@ static CURLcode ossl_on_session_reuse(struct Curl_cfilter *cf,
|
|||
connssl->earlydata_state = ssl_earlydata_await;
|
||||
connssl->state = ssl_connection_deferred;
|
||||
result = Curl_alpn_set_negotiated(cf, data, connssl,
|
||||
(const unsigned char *)scs->alpn,
|
||||
scs->alpn ? strlen(scs->alpn) : 0);
|
||||
(const unsigned char *)scs->alpn,
|
||||
scs->alpn ? strlen(scs->alpn) : 0);
|
||||
*do_early_data = !result;
|
||||
}
|
||||
return result;
|
||||
|
|
@ -4331,8 +4329,7 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
|
|||
/* trace retry_configs if we got some */
|
||||
ossl_trace_ech_retry_configs(data, octx->ssl, 0);
|
||||
}
|
||||
if(rv != SSL_ECH_STATUS_SUCCESS
|
||||
&& data->set.tls_ech & CURLECH_HARD) {
|
||||
if(rv != SSL_ECH_STATUS_SUCCESS && (data->set.tls_ech & CURLECH_HARD)) {
|
||||
infof(data, "ECH: ech-hard failed");
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue