... as failf adds one itself.
Also: add an assert() to failf() that triggers on a newline in the
format string!
Closes #6365
return NULL;
}
- failf(conn->data, "getaddrinfo() thread failed\n");
+ failf(conn->data, "getaddrinfo() thread failed");
return NULL;
}
return NULL;
}
- failf(data, "getaddrinfo() thread failed to start\n");
+ failf(data, "getaddrinfo() thread failed to start");
return NULL;
}
h->init = TRUE;
*didwhat = KEEP_RECV;
if(!resp) {
- failf(data, "hyperstream: couldn't get response\n");
+ failf(data, "hyperstream: couldn't get response");
return CURLE_RECV_ERROR;
}
headers = hyper_response_headers(resp);
if(!headers) {
- failf(data, "hyperstream: couldn't get response headers\n");
+ failf(data, "hyperstream: couldn't get response headers");
result = CURLE_RECV_ERROR;
break;
}
}
if(empty_header(data)) {
- failf(data, "hyperstream: couldn't pass blank header\n");
+ failf(data, "hyperstream: couldn't pass blank header");
result = CURLE_OUT_OF_MEMORY;
break;
}
resp_body = hyper_response_body(resp);
if(!resp_body) {
- failf(data, "hyperstream: couldn't get response body\n");
+ failf(data, "hyperstream: couldn't get response body");
result = CURLE_RECV_ERROR;
break;
}
foreach = hyper_body_foreach(resp_body, hyper_body_chunk, data);
if(!foreach) {
- failf(data, "hyperstream: body foreach failed\n");
+ failf(data, "hyperstream: body foreach failed");
result = CURLE_OUT_OF_MEMORY;
break;
}
if(HYPERE_OK != hyper_headers_add(headers, (uint8_t *)n, nlen,
(uint8_t *)v, vlen)) {
- failf(data, "hyper_headers_add host\n");
+ failf(data, "hyper_headers_add host");
return CURLE_OUT_OF_MEMORY;
}
if(data->set.verbose) {
if(hyper_request_set_uri(req, (uint8_t *)Curl_dyn_uptr(&r),
Curl_dyn_len(&r))) {
- failf(data, "error setting path\n");
+ failf(data, "error setting path");
result = CURLE_OUT_OF_MEMORY;
}
else
headers = hyper_request_headers(req);
if(!headers) {
- failf(data, "hyper_request_headers\n");
+ failf(data, "hyper_request_headers");
goto error;
}
data->req.upload_chunky = FALSE;
sendtask = hyper_clientconn_send(client, req);
if(!sendtask) {
- failf(data, "hyper_clientconn_send\n");
+ failf(data, "hyper_clientconn_send");
goto error;
}
DOHcode d = doh_encode(host, dnstype, p->dohbuffer, sizeof(p->dohbuffer),
&p->dohlen);
if(d) {
- failf(data, "Failed to encode DOH packet [%d]\n", d);
+ failf(data, "Failed to encode DOH packet [%d]", d);
return CURLE_OUT_OF_MEMORY;
}
#endif
) {
/* We can't disable EPSV when doing IPv6, so this is instead a fail */
- failf(conn->data, "Failed EPSV attempt, exiting\n");
+ failf(conn->data, "Failed EPSV attempt, exiting");
return CURLE_WEIRD_SERVER_REPLY;
}
k->badheader = HEADER_ALLBAD;
streamclose(conn, "bad HTTP: No end-of-message indicator");
if(!data->set.http09_allowed) {
- failf(data, "Received HTTP/0.9 when not allowed\n");
+ failf(data, "Received HTTP/0.9 when not allowed");
return CURLE_UNSUPPORTED_PROTOCOL;
}
break;
streamclose(conn, "bad HTTP: No end-of-message indicator");
/* this is not the beginning of a protocol first header line */
if(!data->set.http09_allowed) {
- failf(data, "Received HTTP/0.9 when not allowed\n");
+ failf(data, "Received HTTP/0.9 when not allowed");
return CURLE_UNSUPPORTED_PROTOCOL;
}
k->header = FALSE;
stream = data->req.p.http;
if(!stream) {
- failf(data, "Internal NULL stream!\n");
+ failf(data, "Internal NULL stream!");
(void)Curl_close(&newhandle);
rv = CURL_PUSH_DENY;
goto fail;
stream = data_s->req.p.http;
if(!stream) {
- failf(data_s, "Internal NULL stream! 5\n");
+ failf(data_s, "Internal NULL stream!");
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
if(rv < 0) {
failf(data,
"h2_process_pending_input: nghttp2_session_mem_recv() returned "
- "%zd:%s\n", rv, nghttp2_strerror((int)rv));
+ "%zd:%s", rv, nghttp2_strerror((int)rv));
*err = CURLE_RECV_ERROR;
return -1;
}
/* Check we know the size of the upload */
if(data->state.infilesize < 0) {
- failf(data, "Cannot APPEND with unknown input file size\n");
+ failf(data, "Cannot APPEND with unknown input file size");
return CURLE_UPLOAD_FAILED;
}
void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
{
+ DEBUGASSERT(!strchr(fmt, '\n'));
if(data->set.verbose || data->set.errorbuffer) {
va_list ap;
size_t len;
}
else {
hp = NULL; /* fail! */
- failf(data, "SOCKS4 connection to %s not supported\n", buf);
+ failf(data, "SOCKS4 connection to %s not supported", buf);
}
Curl_resolv_unlock(data, dns); /* not used anymore from now on */
if(proxy_user) {
size_t plen = strlen(proxy_user);
if(plen >= sizeof(sx->socksreq) - 8) {
- failf(data, "Too long SOCKS proxy user name, can't use!\n");
+ failf(data, "Too long SOCKS proxy user name, can't use!");
return CURLPX_LONG_USER;
}
/* copy the proxy name WITH trailing zero */
#endif
else {
hp = NULL; /* fail! */
- failf(data, "SOCKS5 connection to %s not supported\n", dest);
+ failf(data, "SOCKS5 connection to %s not supported", dest);
}
Curl_resolv_unlock(data, dns); /* not used anymore from now on */
}
gss_release_buffer(&min_stat, &status_string);
}
- failf(data, "GSS-API error: %s failed:\n%s", function, buf);
+ failf(data, "GSS-API error: %s failed: %s", function, buf);
return 1;
}
return result;
if(strlen(filename) > (state->blksize - strlen(mode) - 4)) {
- failf(data, "TFTP file name too long\n");
+ failf(data, "TFTP file name too long");
free(filename);
return CURLE_TFTP_ILLEGAL; /* too long file name field */
}
host->name = host->encalloc;
}
else {
- failf(data, "Failed to convert %s to ACE; %s\n", host->name,
+ failf(data, "Failed to convert %s to ACE; %s", host->name,
idn2_strerror(rc));
return CURLE_URL_MALFORMAT;
}
}
else {
char buffer[STRERROR_LEN];
- failf(data, "Failed to convert %s to ACE; %s\n", host->name,
+ failf(data, "Failed to convert %s to ACE; %s", host->name,
Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
return CURLE_URL_MALFORMAT;
}
if(status != SEC_E_OK) {
free(input_token);
- failf(data, "SSPI: couldn't get auth info\n");
+ failf(data, "SSPI: couldn't get auth info");
return CURLE_AUTH_ERROR;
}
status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_DIGEST),
&SecurityPackage);
if(status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
+ failf(data, "SSPI: couldn't get auth info");
return CURLE_AUTH_ERROR;
}
TEXT(SP_NAME_KERBEROS),
&SecurityPackage);
if(status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
+ failf(data, "SSPI: couldn't get auth info");
return CURLE_AUTH_ERROR;
}
status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_NTLM),
&SecurityPackage);
if(status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
+ failf(data, "SSPI: couldn't get auth info");
return CURLE_AUTH_ERROR;
}
TEXT(SP_NAME_NEGOTIATE),
&SecurityPackage);
if(nego->status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
+ failf(data, "SSPI: couldn't get auth info");
return CURLE_AUTH_ERROR;
}
nconsumed =
nghttp3_conn_read_stream(qs->h3conn, stream_id, buf, buflen, fin);
if(nconsumed < 0) {
- failf(qs->conn->data, "nghttp3_conn_read_stream returned error: %s\n",
+ failf(qs->conn->data, "nghttp3_conn_read_stream returned error: %s",
nghttp3_strerror((int)nconsumed));
return NGTCP2_ERR_CALLBACK_FAILURE;
}
rv = nghttp3_conn_add_ack_offset(qs->h3conn, stream_id, datalen);
if(rv != 0) {
- failf(qs->conn->data, "nghttp3_conn_add_ack_offset returned error: %s\n",
+ failf(qs->conn->data, "nghttp3_conn_add_ack_offset returned error: %s",
nghttp3_strerror(rv));
return NGTCP2_ERR_CALLBACK_FAILURE;
}
rv = nghttp3_conn_close_stream(qs->h3conn, stream_id,
app_error_code);
if(rv != 0) {
- failf(qs->conn->data, "nghttp3_conn_close_stream returned error: %s\n",
+ failf(qs->conn->data, "nghttp3_conn_close_stream returned error: %s",
nghttp3_strerror(rv));
return NGTCP2_ERR_CALLBACK_FAILURE;
}
rv = nghttp3_conn_reset_stream(qs->h3conn, stream_id);
if(rv != 0) {
- failf(qs->conn->data, "nghttp3_conn_reset_stream returned error: %s\n",
+ failf(qs->conn->data, "nghttp3_conn_reset_stream returned error: %s",
nghttp3_strerror(rv));
return NGTCP2_ERR_CALLBACK_FAILURE;
}
rv = nghttp3_conn_unblock_stream(qs->h3conn, stream_id);
if(rv != 0) {
- failf(qs->conn->data, "nghttp3_conn_unblock_stream returned error: %s\n",
+ failf(qs->conn->data, "nghttp3_conn_unblock_stream returned error: %s",
nghttp3_strerror(rv));
return NGTCP2_ERR_CALLBACK_FAILURE;
}
rv = ngtcp2_conn_handle_expiry(qs->qconn, ts);
if(rv != 0) {
- failf(conn->data, "ngtcp2_conn_handle_expiry returned error: %s\n",
+ failf(conn->data, "ngtcp2_conn_handle_expiry returned error: %s",
ngtcp2_strerror(rv));
return CURLE_SEND_ERROR;
}
veccnt = nghttp3_conn_writev_stream(qs->h3conn, &stream_id, &fin, vec,
sizeof(vec) / sizeof(vec[0]));
if(veccnt < 0) {
- failf(conn->data, "nghttp3_conn_writev_stream returned error: %s\n",
+ failf(conn->data, "nghttp3_conn_writev_stream returned error: %s",
nghttp3_strerror((int)veccnt));
return CURLE_SEND_ERROR;
}
}
else {
assert(ndatalen == -1);
- failf(conn->data, "ngtcp2_conn_writev_stream returned error: %s\n",
+ failf(conn->data, "ngtcp2_conn_writev_stream returned error: %s",
ngtcp2_strerror((int)outlen));
return CURLE_SEND_ERROR;
}
outlen = ngtcp2_conn_write_pkt(qs->qconn, &ps.path, NULL,
out, pktlen, ts);
if(outlen < 0) {
- failf(conn->data, "ngtcp2_conn_write_pkt returned error: %s\n",
+ failf(conn->data, "ngtcp2_conn_write_pkt returned error: %s",
ngtcp2_strerror((int)outlen));
return CURLE_SEND_ERROR;
}
break;
}
else {
- failf(conn->data, "send() returned %zd (errno %d)\n", sent,
+ failf(conn->data, "send() returned %zd (errno %d)", sent,
SOCKERRNO);
return CURLE_SEND_ERROR;
}
break;
if(sent < 0) {
- failf(conn->data, "quiche_conn_send returned %zd\n",
+ failf(conn->data, "quiche_conn_send returned %zd",
sent);
return CURLE_SEND_ERROR;
}
sent = send(sockfd, out, sent, 0);
if(sent < 0) {
- failf(conn->data, "send() returned %zd\n", sent);
+ failf(conn->data, "send() returned %zd", sent);
return CURLE_SEND_ERROR;
}
} while(1);
hostkey_method = hostkey_method_ssh_dss;
break;
case LIBSSH2_KNOWNHOST_KEY_RSA1:
- failf(data, "Found host key type RSA1 which is not supported\n");
+ failf(data, "Found host key type RSA1 which is not supported");
return CURLE_SSH;
default:
- failf(data, "Unknown host key type: %i\n",
+ failf(data, "Unknown host key type: %i",
(store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK));
return CURLE_SSH;
}
return -1;
}
if(rc < 0) {
- failf(conn->data, "wolfSSH_SFTP_SendWritePacket returned %d\n", rc);
+ failf(conn->data, "wolfSSH_SFTP_SendWritePacket returned %d", rc);
return -1;
}
DEBUGASSERT(rc == (int)len);
DEBUGASSERT(rc <= (int)len);
if(rc < 0) {
- failf(conn->data, "wolfSSH_SFTP_SendReadPacket returned %d\n", rc);
+ failf(conn->data, "wolfSSH_SFTP_SendReadPacket returned %d", rc);
return -1;
}
sshc->offset += len;
ret = load_cafile(ssl_cafile, &backend->anchors, &backend->anchors_len);
if(ret != CURLE_OK) {
if(verifypeer) {
- failf(data, "error setting certificate verify locations:\n"
- " CAfile: %s\n", ssl_cafile);
+ failf(data, "error setting certificate verify locations."
+ " CAfile: %s", ssl_cafile);
return ret;
}
infof(data, "error setting certificate verify locations,"
#ifdef MBEDTLS_ERROR_C
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
#endif /* MBEDTLS_ERROR_C */
- failf(data, "Failed - mbedTLS: ctr_drbg_init returned (-0x%04X) %s\n",
+ failf(data, "Failed - mbedTLS: ctr_drbg_init returned (-0x%04X) %s",
-ret, errorbuf);
}
#else
#ifdef MBEDTLS_ERROR_C
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
#endif /* MBEDTLS_ERROR_C */
- failf(data, "Failed - mbedTLS: ctr_drbg_init returned (-0x%04X) %s\n",
+ failf(data, "Failed - mbedTLS: ctr_drbg_init returned (-0x%04X) %s",
-ret, errorbuf);
}
#endif /* THREADING_SUPPORT */
#ifdef MBEDTLS_ERROR_C
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
#endif /* MBEDTLS_ERROR_C */
- failf(data, "Failed - mbedTLS: ctr_drbg_seed returned (-0x%04X) %s\n",
+ failf(data, "Failed - mbedTLS: ctr_drbg_seed returned (-0x%04X) %s",
-ret, errorbuf);
}
else {
#ifdef MBEDTLS_ERROR_C
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
#endif /* MBEDTLS_ERROR_C */
- failf(data, "mbedTLS: ctr_drbg_init returned (-0x%04X) %s\n",
+ failf(data, "mbedTLS: ctr_drbg_init returned (-0x%04X) %s",
-ret, errorbuf);
}
}
char buf[256];
ENGINE_free(e);
- failf(data, "Failed to initialise SSL Engine '%s':\n%s",
+ failf(data, "Failed to initialise SSL Engine '%s': %s",
engine, ossl_strerror(ERR_get_error(), buf, sizeof(buf)));
return CURLE_SSL_ENGINE_INITFAILED;
}
* as also mismatching CN fields */
else if(DOMAIN_NAME_MISMATCH == detail) {
#if 1
- failf(data, "\tsubject alt name(s) or common name do not match \"%s\"\n",
+ failf(data, "\tsubject alt name(s) or common name do not match \"%s\"",
dispname);
return CURLE_PEER_FAILED_VERIFICATION;
#else
#if LIBWOLFSSL_VERSION_HEX >= 0x02007000 /* 2.7.0 */
else if(ASN_NO_SIGNER_E == detail) {
if(SSL_CONN_CONFIG(verifypeer)) {
- failf(data, "\tCA signer not available for verification\n");
+ failf(data, "\tCA signer not available for verification");
return CURLE_SSL_CACERT_BADFILE;
}
else {