1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-25 09:38:54 -05:00

infof: remove newline from format strings, always append it

- the data needs to be "line-based" anyway since it's also passed to the
  debug callback/application

- it makes infof() work like failf() and consistency is good

- there's an assert that triggers on newlines in the format string

- Also removes a few instances of "..."

- Removes the code that would append "..." to the end of the data *iff*
  it was truncated in infof()

Closes #7357
This commit is contained in:
Daniel Stenberg 2021-07-06 17:05:17 +02:00
parent 1026b36ea0
commit e7416cfd2b
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
69 changed files with 936 additions and 947 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2019 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -460,7 +460,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
(void)data; (void)data;
#endif #endif
if(result) { if(result) {
infof(data, "Excessive alt-svc header, ignoring...\n"); infof(data, "Excessive alt-svc header, ignoring.");
return CURLE_OK; return CURLE_OK;
} }
@ -496,7 +496,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
p++; p++;
len = p - hostp; len = p - hostp;
if(!len || (len >= MAX_ALTSVC_HOSTLEN)) { if(!len || (len >= MAX_ALTSVC_HOSTLEN)) {
infof(data, "Excessive alt-svc host name, ignoring...\n"); infof(data, "Excessive alt-svc host name, ignoring.");
dstalpnid = ALPN_none; dstalpnid = ALPN_none;
} }
else { else {
@ -513,7 +513,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
/* a port number */ /* a port number */
unsigned long port = strtoul(++p, &end_ptr, 10); unsigned long port = strtoul(++p, &end_ptr, 10);
if(port > USHRT_MAX || end_ptr == p || *end_ptr != '\"') { if(port > USHRT_MAX || end_ptr == p || *end_ptr != '\"') {
infof(data, "Unknown alt-svc port number, ignoring...\n"); infof(data, "Unknown alt-svc port number, ignoring.");
dstalpnid = ALPN_none; dstalpnid = ALPN_none;
} }
p = end_ptr; p = end_ptr;
@ -579,12 +579,12 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
as->expires = maxage + time(NULL); as->expires = maxage + time(NULL);
as->persist = persist; as->persist = persist;
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node); Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
infof(data, "Added alt-svc: %s:%d over %s\n", dsthost, dstport, infof(data, "Added alt-svc: %s:%d over %s", dsthost, dstport,
Curl_alpnid2str(dstalpnid)); Curl_alpnid2str(dstalpnid));
} }
} }
else { else {
infof(data, "Unknown alt-svc protocol \"%s\", skipping...\n", infof(data, "Unknown alt-svc protocol \"%s\", skipping.",
alpnbuf); alpnbuf);
} }
} }

View File

@ -187,7 +187,7 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
(conn->http_ntlm_state == NTLMSTATE_TYPE2)) || (conn->http_ntlm_state == NTLMSTATE_TYPE2)) ||
((data->req.httpcode == 407) && ((data->req.httpcode == 407) &&
(conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) { (conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) {
infof(data, "Connection closed while negotiating NTLM\n"); infof(data, "Connection closed while negotiating NTLM");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
Curl_safefree(data->req.newurl); Curl_safefree(data->req.newurl);
} }
@ -200,7 +200,7 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
else else
result = Curl_http_firstwrite(data, data->conn, &done); result = Curl_http_firstwrite(data, data->conn, &done);
if(result || done) { if(result || done) {
infof(data, "Return early from hyper_body_chunk\n"); infof(data, "Return early from hyper_body_chunk");
data->state.hresult = result; data->state.hresult = result;
return HYPER_ITER_BREAK; return HYPER_ITER_BREAK;
} }
@ -345,7 +345,7 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
if(errnum == HYPERE_ABORTED_BY_CALLBACK) { if(errnum == HYPERE_ABORTED_BY_CALLBACK) {
/* override Hyper's view, might not even be an error */ /* override Hyper's view, might not even be an error */
result = data->state.hresult; result = data->state.hresult;
infof(data, "hyperstream is done (by early callback)\n"); infof(data, "hyperstream is done (by early callback)");
} }
else { else {
uint8_t errbuf[256]; uint8_t errbuf[256];
@ -366,7 +366,7 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
else if(h->endtask == task) { else if(h->endtask == task) {
/* end of transfer */ /* end of transfer */
*done = TRUE; *done = TRUE;
infof(data, "hyperstream is done!\n"); infof(data, "hyperstream is done!");
break; break;
} }
else if(t != HYPER_TASK_RESPONSE) { else if(t != HYPER_TASK_RESPONSE) {
@ -707,7 +707,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
the rest of the request in the PERFORM phase. */ the rest of the request in the PERFORM phase. */
*done = TRUE; *done = TRUE;
infof(data, "Time for the Hyper dance\n"); infof(data, "Time for the Hyper dance");
memset(h, 0, sizeof(struct hyptransfer)); memset(h, 0, sizeof(struct hyptransfer));
result = Curl_http_host(data, conn); result = Curl_http_host(data, conn);

View File

@ -266,7 +266,7 @@ CURLcode Curl_conncache_add_conn(struct Curl_easy *data)
connc->num_conn++; connc->num_conn++;
DEBUGF(infof(data, "Added connection %ld. " DEBUGF(infof(data, "Added connection %ld. "
"The cache now contains %zu members\n", "The cache now contains %zu members",
conn->connection_id, connc->num_conn)); conn->connection_id, connc->num_conn));
unlock: unlock:
@ -300,7 +300,7 @@ void Curl_conncache_remove_conn(struct Curl_easy *data,
conn->bundle = NULL; /* removed from it */ conn->bundle = NULL; /* removed from it */
if(connc) { if(connc) {
connc->num_conn--; connc->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members\n", DEBUGF(infof(data, "The cache now contains %zu members",
connc->num_conn)); connc->num_conn));
} }
if(lock) { if(lock) {
@ -410,7 +410,7 @@ bool Curl_conncache_return_conn(struct Curl_easy *data,
conn->lastused = Curl_now(); /* it was used up until now */ conn->lastused = Curl_now(); /* it was used up until now */
if(maxconnects > 0 && if(maxconnects > 0 &&
Curl_conncache_size(data) > maxconnects) { Curl_conncache_size(data) > maxconnects) {
infof(data, "Connection cache is full, closing the oldest one.\n"); infof(data, "Connection cache is full, closing the oldest one");
conn_candidate = Curl_conncache_extract_oldest(data); conn_candidate = Curl_conncache_extract_oldest(data);
if(conn_candidate) { if(conn_candidate) {
@ -466,7 +466,7 @@ Curl_conncache_extract_bundle(struct Curl_easy *data,
/* remove it to prevent another thread from nicking it */ /* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle, conn_candidate); bundle_remove_conn(bundle, conn_candidate);
data->state.conn_cache->num_conn--; data->state.conn_cache->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members\n", DEBUGF(infof(data, "The cache now contains %zu members",
data->state.conn_cache->num_conn)); data->state.conn_cache->num_conn));
} }
@ -528,7 +528,7 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
/* remove it to prevent another thread from nicking it */ /* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle_candidate, conn_candidate); bundle_remove_conn(bundle_candidate, conn_candidate);
connc->num_conn--; connc->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members\n", DEBUGF(infof(data, "The cache now contains %zu members",
connc->num_conn)); connc->num_conn));
} }
CONNCACHE_UNLOCK(data); CONNCACHE_UNLOCK(data);

View File

@ -111,7 +111,7 @@ tcpkeepalive(struct Curl_easy *data,
/* only set IDLE and INTVL if setting KEEPALIVE is successful */ /* only set IDLE and INTVL if setting KEEPALIVE is successful */
if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) { (void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set SO_KEEPALIVE on fd %d\n", sockfd); infof(data, "Failed to set SO_KEEPALIVE on fd %d", sockfd);
} }
else { else {
#if defined(SIO_KEEPALIVE_VALS) #if defined(SIO_KEEPALIVE_VALS)
@ -126,7 +126,7 @@ tcpkeepalive(struct Curl_easy *data,
vals.keepaliveinterval = optval; vals.keepaliveinterval = optval;
if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals), if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals),
NULL, 0, &dummy, NULL, NULL) != 0) { NULL, 0, &dummy, NULL, NULL) != 0) {
infof(data, "Failed to set SIO_KEEPALIVE_VALS on fd %d: %d\n", infof(data, "Failed to set SIO_KEEPALIVE_VALS on fd %d: %d",
(int)sockfd, WSAGetLastError()); (int)sockfd, WSAGetLastError());
} }
#else #else
@ -135,7 +135,7 @@ tcpkeepalive(struct Curl_easy *data,
KEEPALIVE_FACTOR(optval); KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
(void *)&optval, sizeof(optval)) < 0) { (void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPIDLE on fd %d\n", sockfd); infof(data, "Failed to set TCP_KEEPIDLE on fd %d", sockfd);
} }
#endif #endif
#ifdef TCP_KEEPINTVL #ifdef TCP_KEEPINTVL
@ -143,7 +143,7 @@ tcpkeepalive(struct Curl_easy *data,
KEEPALIVE_FACTOR(optval); KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
(void *)&optval, sizeof(optval)) < 0) { (void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPINTVL on fd %d\n", sockfd); infof(data, "Failed to set TCP_KEEPINTVL on fd %d", sockfd);
} }
#endif #endif
#ifdef TCP_KEEPALIVE #ifdef TCP_KEEPALIVE
@ -152,7 +152,7 @@ tcpkeepalive(struct Curl_easy *data,
KEEPALIVE_FACTOR(optval); KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE, if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) { (void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPALIVE on fd %d\n", sockfd); infof(data, "Failed to set TCP_KEEPALIVE on fd %d", sockfd);
} }
#endif #endif
#endif #endif
@ -331,7 +331,7 @@ static CURLcode bindlocal(struct Curl_easy *data,
/* /*
* We now have the numerical IP address in the 'myhost' buffer * We now have the numerical IP address in the 'myhost' buffer
*/ */
infof(data, "Local Interface %s is ip %s using address family %i\n", infof(data, "Local Interface %s is ip %s using address family %i",
dev, myhost, af); dev, myhost, af);
done = 1; done = 1;
break; break;
@ -364,7 +364,7 @@ static CURLcode bindlocal(struct Curl_easy *data,
if(h) { if(h) {
/* convert the resolved address, sizeof myhost >= INET_ADDRSTRLEN */ /* convert the resolved address, sizeof myhost >= INET_ADDRSTRLEN */
Curl_printable_address(h->addr, myhost, sizeof(myhost)); Curl_printable_address(h->addr, myhost, sizeof(myhost));
infof(data, "Name '%s' family %i resolved to '%s' family %i\n", infof(data, "Name '%s' family %i resolved to '%s' family %i",
dev, af, myhost, h->addr->ai_family); dev, af, myhost, h->addr->ai_family);
Curl_resolv_unlock(data, h); Curl_resolv_unlock(data, h);
if(af != h->addr->ai_family) { if(af != h->addr->ai_family) {
@ -458,13 +458,13 @@ static CURLcode bindlocal(struct Curl_easy *data,
error, Curl_strerror(error, buffer, sizeof(buffer))); error, Curl_strerror(error, buffer, sizeof(buffer)));
return CURLE_INTERFACE_FAILED; return CURLE_INTERFACE_FAILED;
} }
infof(data, "Local port: %hu\n", port); infof(data, "Local port: %hu", port);
conn->bits.bound = TRUE; conn->bits.bound = TRUE;
return CURLE_OK; return CURLE_OK;
} }
if(--portnum > 0) { if(--portnum > 0) {
infof(data, "Bind to local port %hu failed, trying next\n", port); infof(data, "Bind to local port %hu failed, trying next", port);
port++; /* try next port */ port++; /* try next port */
/* We re-use/clobber the port variable here below */ /* We re-use/clobber the port variable here below */
if(sock->sa_family == AF_INET) if(sock->sa_family == AF_INET)
@ -921,7 +921,7 @@ CURLcode Curl_is_connected(struct Curl_easy *data,
if(Curl_timediff(now, conn->connecttime) >= if(Curl_timediff(now, conn->connecttime) >=
conn->timeoutms_per_addr[i]) { conn->timeoutms_per_addr[i]) {
infof(data, "After %" CURL_FORMAT_TIMEDIFF_T infof(data, "After %" CURL_FORMAT_TIMEDIFF_T
"ms connect time, move on!\n", conn->timeoutms_per_addr[i]); "ms connect time, move on!", conn->timeoutms_per_addr[i]);
error = ETIMEDOUT; error = ETIMEDOUT;
} }
@ -980,7 +980,7 @@ CURLcode Curl_is_connected(struct Curl_easy *data,
char buffer[STRERROR_LEN]; char buffer[STRERROR_LEN];
Curl_printable_address(conn->tempaddr[i], ipaddress, Curl_printable_address(conn->tempaddr[i], ipaddress,
sizeof(ipaddress)); sizeof(ipaddress));
infof(data, "connect to %s port %u failed: %s\n", infof(data, "connect to %s port %u failed: %s",
ipaddress, conn->port, ipaddress, conn->port,
Curl_strerror(error, buffer, sizeof(buffer))); Curl_strerror(error, buffer, sizeof(buffer)));
#endif #endif
@ -1073,7 +1073,7 @@ static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd)
if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff, if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff,
sizeof(onoff)) < 0) sizeof(onoff)) < 0)
infof(data, "Could not set TCP_NODELAY: %s\n", infof(data, "Could not set TCP_NODELAY: %s",
Curl_strerror(SOCKERRNO, buffer, sizeof(buffer))); Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
#else #else
(void)data; (void)data;
@ -1093,7 +1093,7 @@ static void nosigpipe(struct Curl_easy *data,
if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff, if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff,
sizeof(onoff)) < 0) { sizeof(onoff)) < 0) {
char buffer[STRERROR_LEN]; char buffer[STRERROR_LEN];
infof(data, "Could not set SO_NOSIGPIPE: %s\n", infof(data, "Could not set SO_NOSIGPIPE: %s",
Curl_strerror(SOCKERRNO, buffer, sizeof(buffer))); Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
} }
} }
@ -1188,7 +1188,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,
Curl_closesocket(data, conn, sockfd); Curl_closesocket(data, conn, sockfd);
return CURLE_OK; return CURLE_OK;
} }
infof(data, " Trying %s:%d...\n", ipaddress, port); infof(data, " Trying %s:%d...", ipaddress, port);
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
is_tcp = (addr.family == AF_INET || addr.family == AF_INET6) && is_tcp = (addr.family == AF_INET || addr.family == AF_INET6) &&
@ -1279,7 +1279,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,
#elif defined(TCP_FASTOPEN_CONNECT) /* Linux >= 4.11 */ #elif defined(TCP_FASTOPEN_CONNECT) /* Linux >= 4.11 */
if(setsockopt(sockfd, IPPROTO_TCP, TCP_FASTOPEN_CONNECT, if(setsockopt(sockfd, IPPROTO_TCP, TCP_FASTOPEN_CONNECT,
(void *)&optval, sizeof(optval)) < 0) (void *)&optval, sizeof(optval)) < 0)
infof(data, "Failed to enable TCP Fast Open on fd %d\n", sockfd); infof(data, "Failed to enable TCP Fast Open on fd %d", sockfd);
rc = connect(sockfd, &addr.sa_addr, addr.addrlen); rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
#elif defined(MSG_FASTOPEN) /* old Linux */ #elif defined(MSG_FASTOPEN) /* old Linux */
@ -1329,7 +1329,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,
default: default:
/* unknown error, fallthrough and try another address! */ /* unknown error, fallthrough and try another address! */
infof(data, "Immediate connect fail for %s: %s\n", infof(data, "Immediate connect fail for %s: %s",
ipaddress, Curl_strerror(error, buffer, sizeof(buffer))); ipaddress, Curl_strerror(error, buffer, sizeof(buffer)));
data->state.os_errno = error; data->state.os_errno = error;
@ -1402,7 +1402,7 @@ CURLcode Curl_connecthost(struct Curl_easy *data,
ainext(conn, 1, FALSE); /* assigns conn->tempaddr[1] accordingly */ ainext(conn, 1, FALSE); /* assigns conn->tempaddr[1] accordingly */
DEBUGF(infof(data, "family0 == %s, family1 == %s\n", DEBUGF(infof(data, "family0 == %s, family1 == %s",
conn->tempfamily[0] == AF_INET ? "v4" : "v6", conn->tempfamily[0] == AF_INET ? "v4" : "v6",
conn->tempfamily[1] == AF_INET ? "v4" : "v6")); conn->tempfamily[1] == AF_INET ? "v4" : "v6"));

View File

@ -340,7 +340,7 @@ void Curl_cookie_loadfiles(struct Curl_easy *data)
* Failure may be due to OOM or a bad cookie; both are ignored * Failure may be due to OOM or a bad cookie; both are ignored
* but only the first should be * but only the first should be
*/ */
infof(data, "ignoring failed cookie_init for %s\n", list->data); infof(data, "ignoring failed cookie_init for %s", list->data);
else else
data->cookies = newcookies; data->cookies = newcookies;
list = list->next; list = list->next;
@ -520,7 +520,7 @@ Curl_cookie_add(struct Curl_easy *data,
if(nlen >= (MAX_NAME-1) || len >= (MAX_NAME-1) || if(nlen >= (MAX_NAME-1) || len >= (MAX_NAME-1) ||
((nlen + len) > MAX_NAME)) { ((nlen + len) > MAX_NAME)) {
freecookie(co); freecookie(co);
infof(data, "oversized cookie dropped, name/val %zu + %zu bytes\n", infof(data, "oversized cookie dropped, name/val %zu + %zu bytes",
nlen, len); nlen, len);
return NULL; return NULL;
} }
@ -661,7 +661,7 @@ Curl_cookie_add(struct Curl_easy *data,
* not a domain to which the current host belongs. Mark as bad. * not a domain to which the current host belongs. Mark as bad.
*/ */
badcookie = TRUE; badcookie = TRUE;
infof(data, "skipped cookie with bad tailmatch domain: %s\n", infof(data, "skipped cookie with bad tailmatch domain: %s",
whatptr); whatptr);
} }
} }
@ -1005,7 +1005,7 @@ Curl_cookie_add(struct Curl_easy *data,
if(!acceptable) { if(!acceptable) {
infof(data, "cookie '%s' dropped, domain '%s' must not " infof(data, "cookie '%s' dropped, domain '%s' must not "
"set cookies for '%s'\n", co->name, domain, co->domain); "set cookies for '%s'", co->name, domain, co->domain);
freecookie(co); freecookie(co);
return NULL; return NULL;
} }
@ -1117,7 +1117,7 @@ Curl_cookie_add(struct Curl_easy *data,
if(c->running) if(c->running)
/* Only show this when NOT reading the cookies from a file */ /* Only show this when NOT reading the cookies from a file */
infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, " infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, "
"expire %" CURL_FORMAT_CURL_OFF_T "\n", "expire %" CURL_FORMAT_CURL_OFF_T,
replace_old?"Replaced":"Added", co->name, co->value, replace_old?"Replaced":"Added", co->name, co->value,
co->domain, co->path, co->expires); co->domain, co->path, co->expires);
@ -1743,7 +1743,7 @@ void Curl_flush_cookies(struct Curl_easy *data, bool cleanup)
/* if we have a destination file for all the cookies to get dumped to */ /* if we have a destination file for all the cookies to get dumped to */
res = cookie_output(data, data->cookies, data->set.str[STRING_COOKIEJAR]); res = cookie_output(data, data->cookies, data->set.str[STRING_COOKIEJAR]);
if(res) if(res)
infof(data, "WARNING: failed to save cookies in %s: %s\n", infof(data, "WARNING: failed to save cookies in %s: %s",
data->set.str[STRING_COOKIEJAR], curl_easy_strerror(res)); data->set.str[STRING_COOKIEJAR], curl_easy_strerror(res));
} }
else { else {

View File

@ -59,7 +59,7 @@ OM_uint32 Curl_gss_init_sec_context(
req_flags |= GSS_C_DELEG_POLICY_FLAG; req_flags |= GSS_C_DELEG_POLICY_FLAG;
#else #else
infof(data, "warning: support for CURLGSSAPI_DELEGATION_POLICY_FLAG not " infof(data, "warning: support for CURLGSSAPI_DELEGATION_POLICY_FLAG not "
"compiled in\n"); "compiled in");
#endif #endif
} }
@ -130,7 +130,7 @@ void Curl_gss_log_error(struct Curl_easy *data, const char *prefix,
display_gss_error(minor, GSS_C_MECH_CODE, buf, len); display_gss_error(minor, GSS_C_MECH_CODE, buf, len);
infof(data, "%s%s\n", prefix, buf); infof(data, "%s%s", prefix, buf);
#ifdef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)data; (void)data;
(void)prefix; (void)prefix;

View File

@ -355,17 +355,17 @@ CURLcode Curl_input_ntlm_wb(struct Curl_easy *data,
} }
else { else {
if(*state == NTLMSTATE_LAST) { if(*state == NTLMSTATE_LAST) {
infof(data, "NTLM auth restarted\n"); infof(data, "NTLM auth restarted");
Curl_http_auth_cleanup_ntlm_wb(conn); Curl_http_auth_cleanup_ntlm_wb(conn);
} }
else if(*state == NTLMSTATE_TYPE3) { else if(*state == NTLMSTATE_TYPE3) {
infof(data, "NTLM handshake rejected\n"); infof(data, "NTLM handshake rejected");
Curl_http_auth_cleanup_ntlm_wb(conn); Curl_http_auth_cleanup_ntlm_wb(conn);
*state = NTLMSTATE_NONE; *state = NTLMSTATE_NONE;
return CURLE_REMOTE_ACCESS_DENIED; return CURLE_REMOTE_ACCESS_DENIED;
} }
else if(*state >= NTLMSTATE_TYPE1) { else if(*state >= NTLMSTATE_TYPE1) {
infof(data, "NTLM handshake failure (internal error)\n"); infof(data, "NTLM handshake failure (internal error)");
return CURLE_REMOTE_ACCESS_DENIED; return CURLE_REMOTE_ACCESS_DENIED;
} }

View File

@ -53,14 +53,14 @@ CURLcode Curl_range(struct Curl_easy *data)
if((to_t == CURL_OFFT_INVAL) && !from_t) { if((to_t == CURL_OFFT_INVAL) && !from_t) {
/* X - */ /* X - */
data->state.resume_from = from; data->state.resume_from = from;
DEBUGF(infof(data, "RANGE %" CURL_FORMAT_CURL_OFF_T " to end of file\n", DEBUGF(infof(data, "RANGE %" CURL_FORMAT_CURL_OFF_T " to end of file",
from)); from));
} }
else if((from_t == CURL_OFFT_INVAL) && !to_t) { else if((from_t == CURL_OFFT_INVAL) && !to_t) {
/* -Y */ /* -Y */
data->req.maxdownload = to; data->req.maxdownload = to;
data->state.resume_from = -to; data->state.resume_from = -to;
DEBUGF(infof(data, "RANGE the last %" CURL_FORMAT_CURL_OFF_T " bytes\n", DEBUGF(infof(data, "RANGE the last %" CURL_FORMAT_CURL_OFF_T " bytes",
to)); to));
} }
else { else {
@ -78,12 +78,12 @@ CURLcode Curl_range(struct Curl_easy *data)
data->req.maxdownload = totalsize + 1; /* include last byte */ data->req.maxdownload = totalsize + 1; /* include last byte */
data->state.resume_from = from; data->state.resume_from = from;
DEBUGF(infof(data, "RANGE from %" CURL_FORMAT_CURL_OFF_T DEBUGF(infof(data, "RANGE from %" CURL_FORMAT_CURL_OFF_T
" getting %" CURL_FORMAT_CURL_OFF_T " bytes\n", " getting %" CURL_FORMAT_CURL_OFF_T " bytes",
from, data->req.maxdownload)); from, data->req.maxdownload));
} }
DEBUGF(infof(data, "range-download from %" CURL_FORMAT_CURL_OFF_T DEBUGF(infof(data, "range-download from %" CURL_FORMAT_CURL_OFF_T
" to %" CURL_FORMAT_CURL_OFF_T ", totally %" " to %" CURL_FORMAT_CURL_OFF_T ", totally %"
CURL_FORMAT_CURL_OFF_T " bytes\n", CURL_FORMAT_CURL_OFF_T " bytes",
from, to, data->req.maxdownload)); from, to, data->req.maxdownload));
} }
else else

View File

@ -234,7 +234,7 @@ static void state(struct SASL *sasl, struct Curl_easy *data,
}; };
if(sasl->state != newstate) if(sasl->state != newstate)
infof(data, "SASL %p state change from %s to %s\n", infof(data, "SASL %p state change from %s to %s",
(void *)sasl, names[sasl->state], names[newstate]); (void *)sasl, names[sasl->state], names[newstate]);
#else #else
(void) data; (void) data;

View File

@ -216,7 +216,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
} }
if(!word || (*word == (char)0)) { if(!word || (*word == (char)0)) {
infof(data, "lookup word is missing\n"); infof(data, "lookup word is missing");
word = (char *)"default"; word = (char *)"default";
} }
if(!database || (*database == (char)0)) { if(!database || (*database == (char)0)) {
@ -267,7 +267,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
} }
if(!word || (*word == (char)0)) { if(!word || (*word == (char)0)) {
infof(data, "lookup word is missing\n"); infof(data, "lookup word is missing");
word = (char *)"default"; word = (char *)"default";
} }
if(!database || (*database == (char)0)) { if(!database || (*database == (char)0)) {

View File

@ -193,9 +193,9 @@ static int doh_done(struct Curl_easy *doh, CURLcode result)
struct dohdata *dohp = data->req.doh; struct dohdata *dohp = data->req.doh;
/* so one of the DOH request done for the 'data' transfer is now complete! */ /* so one of the DOH request done for the 'data' transfer is now complete! */
dohp->pending--; dohp->pending--;
infof(data, "a DOH request is completed, %u to go\n", dohp->pending); infof(data, "a DOH request is completed, %u to go", dohp->pending);
if(result) if(result)
infof(data, "DOH request %s\n", curl_easy_strerror(result)); infof(data, "DOH request %s", curl_easy_strerror(result));
if(!dohp->pending) { if(!dohp->pending) {
/* DOH completed */ /* DOH completed */
@ -764,11 +764,11 @@ static void showdoh(struct Curl_easy *data,
const struct dohentry *d) const struct dohentry *d)
{ {
int i; int i;
infof(data, "TTL: %u seconds\n", d->ttl); infof(data, "TTL: %u seconds", d->ttl);
for(i = 0; i < d->numaddr; i++) { for(i = 0; i < d->numaddr; i++) {
const struct dohaddr *a = &d->addr[i]; const struct dohaddr *a = &d->addr[i];
if(a->type == DNS_TYPE_A) { if(a->type == DNS_TYPE_A) {
infof(data, "DOH A: %u.%u.%u.%u\n", infof(data, "DOH A: %u.%u.%u.%u",
a->ip.v4[0], a->ip.v4[1], a->ip.v4[0], a->ip.v4[1],
a->ip.v4[2], a->ip.v4[3]); a->ip.v4[2], a->ip.v4[3]);
} }
@ -788,11 +788,11 @@ static void showdoh(struct Curl_easy *data,
len -= l; len -= l;
ptr += l; ptr += l;
} }
infof(data, "%s\n", buffer); infof(data, "%s", buffer);
} }
} }
for(i = 0; i < d->numcname; i++) { for(i = 0; i < d->numcname; i++) {
infof(data, "CNAME: %s\n", Curl_dyn_ptr(&d->cname[i])); infof(data, "CNAME: %s", Curl_dyn_ptr(&d->cname[i]));
} }
} }
#else #else
@ -958,7 +958,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
&de); &de);
Curl_dyn_free(&p->serverdoh); Curl_dyn_free(&p->serverdoh);
if(rc[slot]) { if(rc[slot]) {
infof(data, "DOH: %s type %s for %s\n", doh_strerror(rc[slot]), infof(data, "DOH: %s type %s for %s", doh_strerror(rc[slot]),
type2name(p->dnstype), dohp->host); type2name(p->dnstype), dohp->host);
} }
} /* next slot */ } /* next slot */
@ -969,7 +969,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
struct Curl_dns_entry *dns; struct Curl_dns_entry *dns;
struct Curl_addrinfo *ai; struct Curl_addrinfo *ai;
infof(data, "DOH Host name: %s\n", dohp->host); infof(data, "DOH Host name: %s", dohp->host);
showdoh(data, &de); showdoh(data, &de);
ai = doh2ai(&de, dohp->host, dohp->port); ai = doh2ai(&de, dohp->host, dohp->port);

View File

@ -417,13 +417,13 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */
ev->list = nxt; ev->list = nxt;
free(m); free(m);
m = nxt; m = nxt;
infof(easy, "socket cb: socket %d REMOVED\n", s); infof(easy, "socket cb: socket %d REMOVED", s);
} }
else { else {
/* The socket 's' is already being monitored, update the activity /* The socket 's' is already being monitored, update the activity
mask. Convert from libcurl bitmask to the poll one. */ mask. Convert from libcurl bitmask to the poll one. */
m->socket.events = socketcb2poll(what); m->socket.events = socketcb2poll(what);
infof(easy, "socket cb: socket %d UPDATED as %s%s\n", s, infof(easy, "socket cb: socket %d UPDATED as %s%s", s,
(what&CURL_POLL_IN)?"IN":"", (what&CURL_POLL_IN)?"IN":"",
(what&CURL_POLL_OUT)?"OUT":""); (what&CURL_POLL_OUT)?"OUT":"");
} }
@ -447,7 +447,7 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */
m->socket.events = socketcb2poll(what); m->socket.events = socketcb2poll(what);
m->socket.revents = 0; m->socket.revents = 0;
ev->list = m; ev->list = m;
infof(easy, "socket cb: socket %d ADDED as %s%s\n", s, infof(easy, "socket cb: socket %d ADDED as %s%s", s,
(what&CURL_POLL_IN)?"IN":"", (what&CURL_POLL_IN)?"IN":"",
(what&CURL_POLL_OUT)?"OUT":""); (what&CURL_POLL_OUT)?"OUT":"");
} }
@ -532,7 +532,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
if(fds[i].revents) { if(fds[i].revents) {
/* socket activity, tell libcurl */ /* socket activity, tell libcurl */
int act = poll2cselect(fds[i].revents); /* convert */ int act = poll2cselect(fds[i].revents); /* convert */
infof(multi->easyp, "call curl_multi_socket_action(socket %d)\n", infof(multi->easyp, "call curl_multi_socket_action(socket %d)",
fds[i].fd); fds[i].fd);
mcode = curl_multi_socket_action(multi, fds[i].fd, act, mcode = curl_multi_socket_action(multi, fds[i].fd, act,
&ev->running_handles); &ev->running_handles);
@ -1027,7 +1027,7 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
if((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) == oldstate) { if((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) == oldstate) {
/* Not changing any pause state, return */ /* Not changing any pause state, return */
DEBUGF(infof(data, "pause: no change, early return\n")); DEBUGF(infof(data, "pause: no change, early return"));
return CURLE_OK; return CURLE_OK;
} }

100
lib/ftp.c
View File

@ -289,7 +289,7 @@ static CURLcode AcceptServerConnect(struct Curl_easy *data)
failf(data, "Error accept()ing server connect"); failf(data, "Error accept()ing server connect");
return CURLE_FTP_PORT_FAILED; return CURLE_FTP_PORT_FAILED;
} }
infof(data, "Connection accepted from server\n"); infof(data, "Connection accepted from server");
/* when this happens within the DO state it is important that we mark us as /* when this happens within the DO state it is important that we mark us as
not needing DO_MORE anymore */ not needing DO_MORE anymore */
conn->bits.do_more = FALSE; conn->bits.do_more = FALSE;
@ -380,7 +380,7 @@ static CURLcode ReceivedServerConnect(struct Curl_easy *data, bool *received)
*received = FALSE; *received = FALSE;
timeout_ms = ftp_timeleft_accept(data); timeout_ms = ftp_timeleft_accept(data);
infof(data, "Checking for server connect\n"); infof(data, "Checking for server connect");
if(timeout_ms < 0) { if(timeout_ms < 0) {
/* if a timeout was already reached, bail out */ /* if a timeout was already reached, bail out */
failf(data, "Accept timeout occurred while waiting server connect"); failf(data, "Accept timeout occurred while waiting server connect");
@ -390,7 +390,7 @@ static CURLcode ReceivedServerConnect(struct Curl_easy *data, bool *received)
/* First check whether there is a cached response from server */ /* First check whether there is a cached response from server */
if(pp->cache_size && pp->cache && pp->cache[0] > '3') { if(pp->cache_size && pp->cache && pp->cache[0] > '3') {
/* Data connection could not be established, let's return */ /* Data connection could not be established, let's return */
infof(data, "There is negative response in cache while serv connect\n"); infof(data, "There is negative response in cache while serv connect");
(void)Curl_GetFTPResponse(data, &nread, &ftpcode); (void)Curl_GetFTPResponse(data, &nread, &ftpcode);
return CURLE_FTP_ACCEPT_FAILED; return CURLE_FTP_ACCEPT_FAILED;
} }
@ -408,11 +408,11 @@ static CURLcode ReceivedServerConnect(struct Curl_easy *data, bool *received)
default: default:
if(result & CURL_CSELECT_IN2) { if(result & CURL_CSELECT_IN2) {
infof(data, "Ready to accept data connection from server\n"); infof(data, "Ready to accept data connection from server");
*received = TRUE; *received = TRUE;
} }
else if(result & CURL_CSELECT_IN) { else if(result & CURL_CSELECT_IN) {
infof(data, "Ctrl conn has data while waiting for data conn\n"); infof(data, "Ctrl conn has data while waiting for data conn");
(void)Curl_GetFTPResponse(data, &nread, &ftpcode); (void)Curl_GetFTPResponse(data, &nread, &ftpcode);
if(ftpcode/100 > 3) if(ftpcode/100 > 3)
@ -444,7 +444,7 @@ static CURLcode InitiateTransfer(struct Curl_easy *data)
if(conn->bits.ftp_use_data_ssl) { if(conn->bits.ftp_use_data_ssl) {
/* since we only have a plaintext TCP connection here, we must now /* since we only have a plaintext TCP connection here, we must now
* do the TLS stuff */ * do the TLS stuff */
infof(data, "Doing the SSL/TLS handshake on the data stream\n"); infof(data, "Doing the SSL/TLS handshake on the data stream");
result = Curl_ssl_connect(data, conn, SECONDARYSOCKET); result = Curl_ssl_connect(data, conn, SECONDARYSOCKET);
if(result) if(result)
return result; return result;
@ -487,7 +487,7 @@ static CURLcode AllowServerConnect(struct Curl_easy *data, bool *connected)
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
*connected = FALSE; *connected = FALSE;
infof(data, "Preparing for accepting server on data port\n"); infof(data, "Preparing for accepting server on data port");
/* Save the time we start accepting server connect */ /* Save the time we start accepting server connect */
Curl_pgrsTime(data, TIMER_STARTACCEPT); Curl_pgrsTime(data, TIMER_STARTACCEPT);
@ -592,7 +592,7 @@ static CURLcode ftp_readresp(struct Curl_easy *data,
* This response code can come at any point so having it treated * This response code can come at any point so having it treated
* generically is a good idea. * generically is a good idea.
*/ */
infof(data, "We got a 421 - timeout!\n"); infof(data, "We got a 421 - timeout!");
state(data, FTP_STOP); state(data, FTP_STOP);
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }
@ -768,7 +768,7 @@ static void _state(struct Curl_easy *data,
(void) lineno; (void) lineno;
#else #else
if(ftpc->state != newstate) if(ftpc->state != newstate)
infof(data, "FTP %p (line %d) state change from %s to %s\n", infof(data, "FTP %p (line %d) state change from %s to %s",
(void *)ftpc, lineno, ftp_state_names[ftpc->state], (void *)ftpc, lineno, ftp_state_names[ftpc->state],
ftp_state_names[newstate]); ftp_state_names[newstate]);
#endif #endif
@ -1139,7 +1139,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
/* The requested bind address is not local. Use the address used for /* The requested bind address is not local. Use the address used for
* the control connection instead and restart the port loop * the control connection instead and restart the port loop
*/ */
infof(data, "bind(port=%hu) on non-local address failed: %s\n", port, infof(data, "bind(port=%hu) on non-local address failed: %s", port,
Curl_strerror(error, buffer, sizeof(buffer))); Curl_strerror(error, buffer, sizeof(buffer)));
sslen = sizeof(ss); sslen = sizeof(ss);
@ -1341,7 +1341,7 @@ static CURLcode ftp_state_use_pasv(struct Curl_easy *data,
if(!result) { if(!result) {
ftpc->count1 = modeoff; ftpc->count1 = modeoff;
state(data, FTP_PASV); state(data, FTP_PASV);
infof(data, "Connect data stream passively\n"); infof(data, "Connect data stream passively");
} }
return result; return result;
} }
@ -1648,7 +1648,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
data->state.infilesize -= data->state.resume_from; data->state.infilesize -= data->state.resume_from;
if(data->state.infilesize <= 0) { if(data->state.infilesize <= 0) {
infof(data, "File already completely uploaded\n"); infof(data, "File already completely uploaded");
/* no data to transfer */ /* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1); Curl_setup_transfer(data, -1, -1, FALSE, -1);
@ -1802,7 +1802,7 @@ static CURLcode ftp_epsv_disable(struct Curl_easy *data,
return CURLE_WEIRD_SERVER_REPLY; return CURLE_WEIRD_SERVER_REPLY;
} }
infof(data, "Failed EPSV attempt. Disabling EPSV\n"); infof(data, "Failed EPSV attempt. Disabling EPSV");
/* disable it for next transfer */ /* disable it for next transfer */
conn->bits.ftp_use_epsv = FALSE; conn->bits.ftp_use_epsv = FALSE;
data->state.errorbuf = FALSE; /* allow error message to get data->state.errorbuf = FALSE; /* allow error message to get
@ -1921,7 +1921,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
if(data->set.ftp_skip_ip) { if(data->set.ftp_skip_ip) {
/* told to ignore the remotely given IP but instead use the host we used /* told to ignore the remotely given IP but instead use the host we used
for the control connection */ for the control connection */
infof(data, "Skip %u.%u.%u.%u for data connection, re-use %s instead\n", infof(data, "Skip %u.%u.%u.%u for data connection, re-use %s instead",
ip[0], ip[1], ip[2], ip[3], ip[0], ip[1], ip[2], ip[3],
conn->host.name); conn->host.name);
ftpc->newhost = strdup(control_address(conn)); ftpc->newhost = strdup(control_address(conn));
@ -2044,7 +2044,7 @@ static CURLcode ftp_state_port_resp(struct Curl_easy *data,
/* the command failed */ /* the command failed */
if(EPRT == fcmd) { if(EPRT == fcmd) {
infof(data, "disabling EPRT usage\n"); infof(data, "disabling EPRT usage");
conn->bits.ftp_use_eprt = FALSE; conn->bits.ftp_use_eprt = FALSE;
} }
fcmd++; fcmd++;
@ -2058,7 +2058,7 @@ static CURLcode ftp_state_port_resp(struct Curl_easy *data,
result = ftp_state_use_port(data, fcmd); result = ftp_state_use_port(data, fcmd);
} }
else { else {
infof(data, "Connect data stream actively\n"); infof(data, "Connect data stream actively");
state(data, FTP_STOP); /* end of DO phase */ state(data, FTP_STOP); /* end of DO phase */
result = ftp_dophase_done(data, FALSE); result = ftp_dophase_done(data, FALSE);
} }
@ -2128,7 +2128,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
} }
break; break;
default: default:
infof(data, "unsupported MDTM reply format\n"); infof(data, "unsupported MDTM reply format");
break; break;
case 550: /* "No such file or directory" */ case 550: /* "No such file or directory" */
failf(data, "Given file does not exist"); failf(data, "Given file does not exist");
@ -2142,7 +2142,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
case CURL_TIMECOND_IFMODSINCE: case CURL_TIMECOND_IFMODSINCE:
default: default:
if(data->info.filetime <= data->set.timevalue) { if(data->info.filetime <= data->set.timevalue) {
infof(data, "The requested document is not new enough\n"); infof(data, "The requested document is not new enough");
ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */ ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */
data->info.timecond = TRUE; data->info.timecond = TRUE;
state(data, FTP_STOP); state(data, FTP_STOP);
@ -2151,7 +2151,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
break; break;
case CURL_TIMECOND_IFUNMODSINCE: case CURL_TIMECOND_IFUNMODSINCE:
if(data->info.filetime > data->set.timevalue) { if(data->info.filetime > data->set.timevalue) {
infof(data, "The requested document is not old enough\n"); infof(data, "The requested document is not old enough");
ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */ ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */
data->info.timecond = TRUE; data->info.timecond = TRUE;
state(data, FTP_STOP); state(data, FTP_STOP);
@ -2161,7 +2161,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
} /* switch */ } /* switch */
} }
else { else {
infof(data, "Skipping time comparison\n"); infof(data, "Skipping time comparison");
} }
} }
@ -2186,7 +2186,7 @@ static CURLcode ftp_state_type_resp(struct Curl_easy *data,
return CURLE_FTP_COULDNT_SET_TYPE; return CURLE_FTP_COULDNT_SET_TYPE;
} }
if(ftpcode != 200) if(ftpcode != 200)
infof(data, "Got a %03d response code instead of the assumed 200\n", infof(data, "Got a %03d response code instead of the assumed 200",
ftpcode); ftpcode);
if(instate == FTP_TYPE) if(instate == FTP_TYPE)
@ -2219,7 +2219,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data,
/* We always (attempt to) get the size of downloads, so it is done before /* We always (attempt to) get the size of downloads, so it is done before
this even when not doing resumes. */ this even when not doing resumes. */
if(filesize == -1) { if(filesize == -1) {
infof(data, "ftp server doesn't support SIZE\n"); infof(data, "ftp server doesn't support SIZE");
/* We couldn't get the size and therefore we can't know if there really /* We couldn't get the size and therefore we can't know if there really
is a part of the file left to get, although the server will just is a part of the file left to get, although the server will just
close the connection when we start the connection so it won't cause close the connection when we start the connection so it won't cause
@ -2256,7 +2256,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data,
if(ftp->downloadsize == 0) { if(ftp->downloadsize == 0) {
/* no data to transfer */ /* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1); Curl_setup_transfer(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded\n"); infof(data, "File already completely downloaded");
/* Set ->transfer so that we won't get any error in ftp_done() /* Set ->transfer so that we won't get any error in ftp_done()
* because we didn't transfer the any file */ * because we didn't transfer the any file */
@ -2267,7 +2267,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data,
/* Set resume file transfer offset */ /* Set resume file transfer offset */
infof(data, "Instructs server to resume from offset %" infof(data, "Instructs server to resume from offset %"
CURL_FORMAT_CURL_OFF_T "\n", data->state.resume_from); CURL_FORMAT_CURL_OFF_T, data->state.resume_from);
result = Curl_pp_sendf(data, &ftpc->pp, "REST %" CURL_FORMAT_CURL_OFF_T, result = Curl_pp_sendf(data, &ftpc->pp, "REST %" CURL_FORMAT_CURL_OFF_T,
data->state.resume_from); data->state.resume_from);
@ -2413,7 +2413,7 @@ static CURLcode ftp_state_stor_resp(struct Curl_easy *data,
if(!connected) { if(!connected) {
struct ftp_conn *ftpc = &conn->proto.ftpc; struct ftp_conn *ftpc = &conn->proto.ftpc;
infof(data, "Data conn was not available immediately\n"); infof(data, "Data conn was not available immediately");
ftpc->wait_data_conn = TRUE; ftpc->wait_data_conn = TRUE;
} }
@ -2506,11 +2506,11 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
else if((instate != FTP_LIST) && (data->state.prefer_ascii)) else if((instate != FTP_LIST) && (data->state.prefer_ascii))
size = -1; /* kludge for servers that understate ASCII mode file size */ size = -1; /* kludge for servers that understate ASCII mode file size */
infof(data, "Maxdownload = %" CURL_FORMAT_CURL_OFF_T "\n", infof(data, "Maxdownload = %" CURL_FORMAT_CURL_OFF_T,
data->req.maxdownload); data->req.maxdownload);
if(instate != FTP_LIST) if(instate != FTP_LIST)
infof(data, "Getting file with size: %" CURL_FORMAT_CURL_OFF_T "\n", infof(data, "Getting file with size: %" CURL_FORMAT_CURL_OFF_T,
size); size);
/* FTP download: */ /* FTP download: */
@ -2526,7 +2526,7 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
if(!connected) { if(!connected) {
struct ftp_conn *ftpc = &conn->proto.ftpc; struct ftp_conn *ftpc = &conn->proto.ftpc;
infof(data, "Data conn was not available immediately\n"); infof(data, "Data conn was not available immediately");
state(data, FTP_STOP); state(data, FTP_STOP);
ftpc->wait_data_conn = TRUE; ftpc->wait_data_conn = TRUE;
} }
@ -2702,9 +2702,9 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]); Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]);
if(Curl_sec_login(data, conn)) if(Curl_sec_login(data, conn))
infof(data, "Logging in with password in cleartext!\n"); infof(data, "Logging in with password in cleartext!");
else else
infof(data, "Authentication successful\n"); infof(data, "Authentication successful");
} }
#endif #endif
@ -2895,7 +2895,7 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
} }
Curl_safefree(ftpc->entrypath); Curl_safefree(ftpc->entrypath);
ftpc->entrypath = dir; /* remember this */ ftpc->entrypath = dir; /* remember this */
infof(data, "Entry path is '%s'\n", ftpc->entrypath); infof(data, "Entry path is '%s'", ftpc->entrypath);
/* also save it where getinfo can access it: */ /* also save it where getinfo can access it: */
data->state.most_recent_ftp_entrypath = ftpc->entrypath; data->state.most_recent_ftp_entrypath = ftpc->entrypath;
state(data, FTP_SYST); state(data, FTP_SYST);
@ -2904,18 +2904,18 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
Curl_safefree(ftpc->entrypath); Curl_safefree(ftpc->entrypath);
ftpc->entrypath = dir; /* remember this */ ftpc->entrypath = dir; /* remember this */
infof(data, "Entry path is '%s'\n", ftpc->entrypath); infof(data, "Entry path is '%s'", ftpc->entrypath);
/* also save it where getinfo can access it: */ /* also save it where getinfo can access it: */
data->state.most_recent_ftp_entrypath = ftpc->entrypath; data->state.most_recent_ftp_entrypath = ftpc->entrypath;
} }
else { else {
/* couldn't get the path */ /* couldn't get the path */
free(dir); free(dir);
infof(data, "Failed to figure out path\n"); infof(data, "Failed to figure out path");
} }
} }
state(data, FTP_STOP); /* we are done with the CONNECT phase! */ state(data, FTP_STOP); /* we are done with the CONNECT phase! */
DEBUGF(infof(data, "protocol connect phase DONE\n")); DEBUGF(infof(data, "protocol connect phase DONE"));
break; break;
case FTP_SYST: case FTP_SYST:
@ -2962,7 +2962,7 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
} }
state(data, FTP_STOP); /* we are done with the CONNECT phase! */ state(data, FTP_STOP); /* we are done with the CONNECT phase! */
DEBUGF(infof(data, "protocol connect phase DONE\n")); DEBUGF(infof(data, "protocol connect phase DONE"));
break; break;
case FTP_NAMEFMT: case FTP_NAMEFMT:
@ -2973,7 +2973,7 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
} }
state(data, FTP_STOP); /* we are done with the CONNECT phase! */ state(data, FTP_STOP); /* we are done with the CONNECT phase! */
DEBUGF(infof(data, "protocol connect phase DONE\n")); DEBUGF(infof(data, "protocol connect phase DONE"));
break; break;
case FTP_QUOTE: case FTP_QUOTE:
@ -3272,7 +3272,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
} }
if(ftpc->prevpath) if(ftpc->prevpath)
infof(data, "Remembering we are in dir \"%s\"\n", ftpc->prevpath); infof(data, "Remembering we are in dir \"%s\"", ftpc->prevpath);
} }
/* free the dir tree and file parts */ /* free the dir tree and file parts */
@ -3338,7 +3338,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
if(ftpc->dont_check && data->req.maxdownload > 0) { if(ftpc->dont_check && data->req.maxdownload > 0) {
/* we have just sent ABOR and there is no reliable way to check if it was /* we have just sent ABOR and there is no reliable way to check if it was
* successful or not; we have to close the connection now */ * successful or not; we have to close the connection now */
infof(data, "partial download completed, closing connection\n"); infof(data, "partial download completed, closing connection");
connclose(conn, "Partial download with no ability to check"); connclose(conn, "Partial download with no ability to check");
return result; return result;
} }
@ -3529,7 +3529,7 @@ ftp_pasv_verbose(struct Curl_easy *data,
{ {
char buf[256]; char buf[256];
Curl_printable_address(ai, buf, sizeof(buf)); Curl_printable_address(ai, buf, sizeof(buf));
infof(data, "Connecting to %s (%s) port %d\n", newhost, buf, port); infof(data, "Connecting to %s (%s) port %d", newhost, buf, port);
} }
#endif #endif
@ -3569,7 +3569,7 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep)
/* Ready to do more? */ /* Ready to do more? */
if(connected) { if(connected) {
DEBUGF(infof(data, "DO-MORE connected phase starts\n")); DEBUGF(infof(data, "DO-MORE connected phase starts"));
} }
else { else {
if(result && (ftpc->count1 == 0)) { if(result && (ftpc->count1 == 0)) {
@ -3692,7 +3692,7 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep)
if(!ftpc->wait_data_conn) { if(!ftpc->wait_data_conn) {
/* no waiting for the data connection so this is now complete */ /* no waiting for the data connection so this is now complete */
*completep = 1; *completep = 1;
DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result)); DEBUGF(infof(data, "DO-MORE phase ends with %d", (int)result));
} }
return result; return result;
@ -3717,7 +3717,7 @@ CURLcode ftp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
if(data->set.opt_no_body) { if(data->set.opt_no_body) {
/* requested no body means no transfer... */ /* requested no body means no transfer... */
@ -3737,10 +3737,10 @@ CURLcode ftp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[SECONDARYSOCKET]; *connected = conn->bits.tcpconnect[SECONDARYSOCKET];
infof(data, "ftp_perform ends with SECONDARY: %d\n", *connected); infof(data, "ftp_perform ends with SECONDARY: %d", *connected);
if(*dophase_done) if(*dophase_done)
DEBUGF(infof(data, "DO phase is complete1\n")); DEBUGF(infof(data, "DO phase is complete1"));
return result; return result;
} }
@ -3834,7 +3834,7 @@ static CURLcode init_wc_data(struct Curl_easy *data)
/* let the writefunc callback know the transfer */ /* let the writefunc callback know the transfer */
data->set.out = data; data->set.out = data;
infof(data, "Wildcard - Parsing started\n"); infof(data, "Wildcard - Parsing started");
return CURLE_OK; return CURLE_OK;
fail: fail:
@ -3901,7 +3901,7 @@ static CURLcode wc_statemach(struct Curl_easy *data)
free(ftp->pathalloc); free(ftp->pathalloc);
ftp->pathalloc = ftp->path = tmp_path; ftp->pathalloc = ftp->path = tmp_path;
infof(data, "Wildcard - START of \"%s\"\n", finfo->filename); infof(data, "Wildcard - START of \"%s\"", finfo->filename);
if(data->set.chunk_bgn) { if(data->set.chunk_bgn) {
long userresponse; long userresponse;
Curl_set_in_callback(data, true); Curl_set_in_callback(data, true);
@ -3910,7 +3910,7 @@ static CURLcode wc_statemach(struct Curl_easy *data)
Curl_set_in_callback(data, false); Curl_set_in_callback(data, false);
switch(userresponse) { switch(userresponse) {
case CURL_CHUNK_BGN_FUNC_SKIP: case CURL_CHUNK_BGN_FUNC_SKIP:
infof(data, "Wildcard - \"%s\" skipped by user\n", infof(data, "Wildcard - \"%s\" skipped by user",
finfo->filename); finfo->filename);
wildcard->state = CURLWC_SKIP; wildcard->state = CURLWC_SKIP;
continue; continue;
@ -4233,7 +4233,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
n -= ftpc->file?strlen(ftpc->file):0; n -= ftpc->file?strlen(ftpc->file):0;
if((strlen(oldPath) == n) && !strncmp(rawPath, oldPath, n)) { if((strlen(oldPath) == n) && !strncmp(rawPath, oldPath, n)) {
infof(data, "Request has same path as previous transfer\n"); infof(data, "Request has same path as previous transfer");
ftpc->cwddone = TRUE; ftpc->cwddone = TRUE;
} }
} }
@ -4279,11 +4279,11 @@ static CURLcode ftp_doing(struct Curl_easy *data,
CURLcode result = ftp_multi_statemach(data, dophase_done); CURLcode result = ftp_multi_statemach(data, dophase_done);
if(result) if(result)
DEBUGF(infof(data, "DO phase failed\n")); DEBUGF(infof(data, "DO phase failed"));
else if(*dophase_done) { else if(*dophase_done) {
result = ftp_dophase_done(data, FALSE /* not connected */); result = ftp_dophase_done(data, FALSE /* not connected */);
DEBUGF(infof(data, "DO phase is complete2\n")); DEBUGF(infof(data, "DO phase is complete2"));
} }
return result; return result;
} }

View File

@ -290,7 +290,7 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data,
user.cache_timeout = data->set.dns_cache_timeout; user.cache_timeout = data->set.dns_cache_timeout;
if(hostcache_timestamp_remove(&user, dns)) { if(hostcache_timestamp_remove(&user, dns)) {
infof(data, "Hostname in DNS cache was stale, zapped\n"); infof(data, "Hostname in DNS cache was stale, zapped");
dns = NULL; /* the memory deallocation is being handled by the hash */ dns = NULL; /* the memory deallocation is being handled by the hash */
Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1); Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1);
} }
@ -588,7 +588,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
dns = fetch_addr(data, hostname, port); dns = fetch_addr(data, hostname, port);
if(dns) { if(dns) {
infof(data, "Hostname %s was found in DNS cache\n", hostname); infof(data, "Hostname %s was found in DNS cache", hostname);
dns->inuse++; /* we use it! */ dns->inuse++; /* we use it! */
rc = CURLRESOLV_RESOLVED; rc = CURLRESOLV_RESOLVED;
} }
@ -853,7 +853,7 @@ enum resolve_t Curl_resolv_timeout(struct Curl_easy *data,
#else #else
#ifndef CURLRES_ASYNCH #ifndef CURLRES_ASYNCH
if(timeoutms) if(timeoutms)
infof(data, "timeout on name lookup is not supported\n"); infof(data, "timeout on name lookup is not supported");
#else #else
(void)timeoutms; /* timeoutms not used with an async resolver */ (void)timeoutms; /* timeoutms not used with an async resolver */
#endif #endif
@ -991,7 +991,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
size_t entry_len; size_t entry_len;
if(2 != sscanf(hostp->data + 1, "%255[^:]:%d", hostname, &port)) { if(2 != sscanf(hostp->data + 1, "%255[^:]:%d", hostname, &port)) {
infof(data, "Couldn't parse CURLOPT_RESOLVE removal entry '%s'!\n", infof(data, "Couldn't parse CURLOPT_RESOLVE removal entry '%s'",
hostp->data); hostp->data);
continue; continue;
} }
@ -1080,7 +1080,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
#ifndef ENABLE_IPV6 #ifndef ENABLE_IPV6
if(strchr(address, ':')) { if(strchr(address, ':')) {
infof(data, "Ignoring resolve address '%s', missing IPv6 support.\n", infof(data, "Ignoring resolve address '%s', missing IPv6 support.",
address); address);
continue; continue;
} }
@ -1088,7 +1088,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
ai = Curl_str2addr(address, port); ai = Curl_str2addr(address, port);
if(!ai) { if(!ai) {
infof(data, "Resolve address '%s' found illegal!\n", address); infof(data, "Resolve address '%s' found illegal!", address);
goto err; goto err;
} }
@ -1124,7 +1124,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1); dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
if(dns) { if(dns) {
infof(data, "RESOLVE %s:%d is - old addresses discarded!\n", infof(data, "RESOLVE %s:%d is - old addresses discarded!",
hostname, port); hostname, port);
/* delete old entry, there are two reasons for this /* delete old entry, there are two reasons for this
1. old entry may have different addresses. 1. old entry may have different addresses.
@ -1157,12 +1157,12 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
Curl_freeaddrinfo(head); Curl_freeaddrinfo(head);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
infof(data, "Added %s:%d:%s to DNS cache%s\n", infof(data, "Added %s:%d:%s to DNS cache%s",
hostname, port, addresses, permanent ? "" : " (non-permanent)"); hostname, port, addresses, permanent ? "" : " (non-permanent)");
/* Wildcard hostname */ /* Wildcard hostname */
if(hostname[0] == '*' && hostname[1] == '\0') { if(hostname[0] == '*' && hostname[1] == '\0') {
infof(data, "RESOLVE %s:%d is wildcard, enabling wildcard checks\n", infof(data, "RESOLVE %s:%d is wildcard, enabling wildcard checks",
hostname, port); hostname, port);
data->state.wildcard_resolve = true; data->state.wildcard_resolve = true;
} }

View File

@ -104,7 +104,7 @@ struct Curl_addrinfo *Curl_getaddrinfo(struct Curl_easy *data,
ai = Curl_ipv4_resolve_r(hostname, port); ai = Curl_ipv4_resolve_r(hostname, port);
if(!ai) if(!ai)
infof(data, "Curl_ipv4_resolve_r failed for %s\n", hostname); infof(data, "Curl_ipv4_resolve_r failed for %s", hostname);
return ai; return ai;
} }

View File

@ -172,7 +172,7 @@ struct Curl_addrinfo *Curl_getaddrinfo(struct Curl_easy *data,
error = Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &res); error = Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &res);
if(error) { if(error) {
infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port); infof(data, "getaddrinfo(3) failed for %s:%d", hostname, port);
return NULL; return NULL;
} }

View File

@ -504,7 +504,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
/* rewind data when completely done sending! */ /* rewind data when completely done sending! */
if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) { if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) {
conn->bits.rewindaftersend = TRUE; conn->bits.rewindaftersend = TRUE;
infof(data, "Rewind stream after send\n"); infof(data, "Rewind stream after send");
} }
return CURLE_OK; return CURLE_OK;
@ -515,7 +515,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
return CURLE_OK; return CURLE_OK;
infof(data, "NTLM send, close instead of sending %" infof(data, "NTLM send, close instead of sending %"
CURL_FORMAT_CURL_OFF_T " bytes\n", CURL_FORMAT_CURL_OFF_T " bytes",
(curl_off_t)(expectsend - bytessent)); (curl_off_t)(expectsend - bytessent));
} }
#endif #endif
@ -532,7 +532,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
/* rewind data when completely done sending! */ /* rewind data when completely done sending! */
if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) { if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) {
conn->bits.rewindaftersend = TRUE; conn->bits.rewindaftersend = TRUE;
infof(data, "Rewind stream after send\n"); infof(data, "Rewind stream after send");
} }
return CURLE_OK; return CURLE_OK;
@ -543,7 +543,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
return CURLE_OK; return CURLE_OK;
infof(data, "NEGOTIATE send, close instead of sending %" infof(data, "NEGOTIATE send, close instead of sending %"
CURL_FORMAT_CURL_OFF_T " bytes\n", CURL_FORMAT_CURL_OFF_T " bytes",
(curl_off_t)(expectsend - bytessent)); (curl_off_t)(expectsend - bytessent));
} }
#endif #endif
@ -756,14 +756,14 @@ output_auth_headers(struct Curl_easy *data,
if(auth) { if(auth) {
#ifndef CURL_DISABLE_PROXY #ifndef CURL_DISABLE_PROXY
infof(data, "%s auth using %s with user '%s'\n", infof(data, "%s auth using %s with user '%s'",
proxy ? "Proxy" : "Server", auth, proxy ? "Proxy" : "Server", auth,
proxy ? (data->state.aptr.proxyuser ? proxy ? (data->state.aptr.proxyuser ?
data->state.aptr.proxyuser : "") : data->state.aptr.proxyuser : "") :
(data->state.aptr.user ? (data->state.aptr.user ?
data->state.aptr.user : "")); data->state.aptr.user : ""));
#else #else
infof(data, "Server auth using %s with user '%s'\n", infof(data, "Server auth using %s with user '%s'",
auth, data->state.aptr.user ? auth, data->state.aptr.user ?
data->state.aptr.user : ""); data->state.aptr.user : "");
#endif #endif
@ -995,14 +995,14 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
result = Curl_input_ntlm_wb(data, conn, proxy, auth); result = Curl_input_ntlm_wb(data, conn, proxy, auth);
if(result) { if(result) {
infof(data, "Authentication problem. Ignoring this.\n"); infof(data, "Authentication problem. Ignoring this.");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
} }
#endif #endif
} }
else { else {
infof(data, "Authentication problem. Ignoring this.\n"); infof(data, "Authentication problem. Ignoring this.");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
} }
@ -1013,7 +1013,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
#ifndef CURL_DISABLE_CRYPTO_AUTH #ifndef CURL_DISABLE_CRYPTO_AUTH
if(checkprefix("Digest", auth) && is_valid_auth_separator(auth[6])) { if(checkprefix("Digest", auth) && is_valid_auth_separator(auth[6])) {
if((authp->avail & CURLAUTH_DIGEST) != 0) if((authp->avail & CURLAUTH_DIGEST) != 0)
infof(data, "Ignoring duplicate digest auth header.\n"); infof(data, "Ignoring duplicate digest auth header.");
else if(Curl_auth_is_digest_supported()) { else if(Curl_auth_is_digest_supported()) {
CURLcode result; CURLcode result;
@ -1026,7 +1026,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
* Digest */ * Digest */
result = Curl_input_digest(data, proxy, auth); result = Curl_input_digest(data, proxy, auth);
if(result) { if(result) {
infof(data, "Authentication problem. Ignoring this.\n"); infof(data, "Authentication problem. Ignoring this.");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
} }
@ -1042,7 +1042,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
anyway, which basically means our name+password isn't anyway, which basically means our name+password isn't
valid. */ valid. */
authp->avail = CURLAUTH_NONE; authp->avail = CURLAUTH_NONE;
infof(data, "Authentication problem. Ignoring this.\n"); infof(data, "Authentication problem. Ignoring this.");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
} }
@ -1055,7 +1055,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
/* We asked for Bearer authentication but got a 40X back /* We asked for Bearer authentication but got a 40X back
anyway, which basically means our token isn't valid. */ anyway, which basically means our token isn't valid. */
authp->avail = CURLAUTH_NONE; authp->avail = CURLAUTH_NONE;
infof(data, "Authentication problem. Ignoring this.\n"); infof(data, "Authentication problem. Ignoring this.");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
} }
@ -2910,7 +2910,7 @@ CURLcode Curl_http_firstwrite(struct Curl_easy *data,
/* We have a new url to load, but since we want to be able to re-use this /* We have a new url to load, but since we want to be able to re-use this
connection properly, we read the full response in "ignore more" */ connection properly, we read the full response in "ignore more" */
k->ignorebody = TRUE; k->ignorebody = TRUE;
infof(data, "Ignoring the response-body\n"); infof(data, "Ignoring the response-body");
} }
if(data->state.resume_from && !k->content_range && if(data->state.resume_from && !k->content_range &&
(data->state.httpreq == HTTPREQ_GET) && (data->state.httpreq == HTTPREQ_GET) &&
@ -2945,7 +2945,7 @@ CURLcode Curl_http_firstwrite(struct Curl_easy *data,
/* We're simulating a http 304 from server so we return /* We're simulating a http 304 from server so we return
what should have been returned from the server */ what should have been returned from the server */
data->info.httpcode = 304; data->info.httpcode = 304;
infof(data, "Simulate a HTTP 304 response!\n"); infof(data, "Simulate a HTTP 304 response!");
/* we abort the transfer before it is completed == we ruin the /* we abort the transfer before it is completed == we ruin the
re-use ability. Close the connection */ re-use ability. Close the connection */
connclose(conn, "Simulated 304 handling"); connclose(conn, "Simulated 304 handling");
@ -3035,11 +3035,11 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) { if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
/* We don't support HTTP/2 proxies yet. Also it's debatable /* We don't support HTTP/2 proxies yet. Also it's debatable
whether or not this setting should apply to HTTP/2 proxies. */ whether or not this setting should apply to HTTP/2 proxies. */
infof(data, "Ignoring HTTP/2 prior knowledge due to proxy\n"); infof(data, "Ignoring HTTP/2 prior knowledge due to proxy");
break; break;
} }
#endif #endif
DEBUGF(infof(data, "HTTP/2 over clean TCP\n")); DEBUGF(infof(data, "HTTP/2 over clean TCP"));
conn->httpversion = 20; conn->httpversion = 20;
result = Curl_http2_switched(data, NULL, 0); result = Curl_http2_switched(data, NULL, 0);
@ -3260,7 +3260,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
/* already sent the entire request body, mark the "upload" as /* already sent the entire request body, mark the "upload" as
complete */ complete */
infof(data, "upload completely sent off: %" CURL_FORMAT_CURL_OFF_T infof(data, "upload completely sent off: %" CURL_FORMAT_CURL_OFF_T
" out of %" CURL_FORMAT_CURL_OFF_T " bytes\n", " out of %" CURL_FORMAT_CURL_OFF_T " bytes",
data->req.writebytecount, http->postsize); data->req.writebytecount, http->postsize);
data->req.upload_done = TRUE; data->req.upload_done = TRUE;
data->req.keepon &= ~KEEP_SEND; /* we're done writing */ data->req.keepon &= ~KEEP_SEND; /* we're done writing */
@ -3418,7 +3418,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
return CURLE_FILESIZE_EXCEEDED; return CURLE_FILESIZE_EXCEEDED;
} }
streamclose(conn, "overflow content-length"); streamclose(conn, "overflow content-length");
infof(data, "Overflow Content-Length: value!\n"); infof(data, "Overflow Content-Length: value!");
} }
else { else {
/* negative or just rubbish - bad HTTP */ /* negative or just rubbish - bad HTTP */
@ -3450,7 +3450,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
* Default action for 1.0 is to close. * Default action for 1.0 is to close.
*/ */
connkeep(conn, "Proxy-Connection keep-alive"); /* don't close */ connkeep(conn, "Proxy-Connection keep-alive"); /* don't close */
infof(data, "HTTP/1.0 proxy connection set to keep alive!\n"); infof(data, "HTTP/1.0 proxy connection set to keep alive!");
} }
else if((conn->httpversion == 11) && else if((conn->httpversion == 11) &&
conn->bits.httpproxy && conn->bits.httpproxy &&
@ -3460,7 +3460,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
* close down after this transfer. * close down after this transfer.
*/ */
connclose(conn, "Proxy-Connection: asked to close after done"); connclose(conn, "Proxy-Connection: asked to close after done");
infof(data, "HTTP/1.1 proxy connection set close!\n"); infof(data, "HTTP/1.1 proxy connection set close!");
} }
#endif #endif
else if((conn->httpversion == 10) && else if((conn->httpversion == 10) &&
@ -3472,7 +3472,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
* *
* [RFC2068, section 19.7.1] */ * [RFC2068, section 19.7.1] */
connkeep(conn, "Connection keep-alive"); connkeep(conn, "Connection keep-alive");
infof(data, "HTTP/1.0 connection set to keep alive!\n"); infof(data, "HTTP/1.0 connection set to keep alive!");
} }
else if(Curl_compareheader(headp, "Connection:", "close")) { else if(Curl_compareheader(headp, "Connection:", "close")) {
/* /*
@ -3653,10 +3653,10 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
Curl_hsts_parse(data->hsts, data->state.up.hostname, Curl_hsts_parse(data->hsts, data->state.up.hostname,
headp + strlen("Strict-Transport-Security:")); headp + strlen("Strict-Transport-Security:"));
if(check) if(check)
infof(data, "Illegal STS header skipped\n"); infof(data, "Illegal STS header skipped");
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
else else
infof(data, "Parsed STS header fine (%zu entries)\n", infof(data, "Parsed STS header fine (%zu entries)",
data->hsts->list.size); data->hsts->list.size);
#endif #endif
} }
@ -3726,12 +3726,12 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
/* Default action for HTTP/1.0 must be to close, unless /* Default action for HTTP/1.0 must be to close, unless
we get one of those fancy headers that tell us the we get one of those fancy headers that tell us the
server keeps it open for us! */ server keeps it open for us! */
infof(data, "HTTP 1.0, assume close after body\n"); infof(data, "HTTP 1.0, assume close after body");
connclose(conn, "HTTP/1.0 close after body"); connclose(conn, "HTTP/1.0 close after body");
} }
else if(conn->httpversion == 20 || else if(conn->httpversion == 20 ||
(k->upgr101 == UPGR101_REQUESTED && k->httpcode == 101)) { (k->upgr101 == UPGR101_REQUESTED && k->httpcode == 101)) {
DEBUGF(infof(data, "HTTP/2 found, allow multiplexing\n")); DEBUGF(infof(data, "HTTP/2 found, allow multiplexing"));
/* HTTP/2 cannot avoid multiplexing since it is a core functionality /* HTTP/2 cannot avoid multiplexing since it is a core functionality
of the protocol */ of the protocol */
conn->bundle->multiuse = BUNDLE_MULTIPLEX; conn->bundle->multiuse = BUNDLE_MULTIPLEX;
@ -3740,7 +3740,7 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
!conn->bits.close) { !conn->bits.close) {
/* If HTTP version is >= 1.1 and connection is persistent */ /* If HTTP version is >= 1.1 and connection is persistent */
DEBUGF(infof(data, DEBUGF(infof(data,
"HTTP 1.1 or later with persistent connection\n")); "HTTP 1.1 or later with persistent connection"));
} }
k->http_bodyless = k->httpcode >= 100 && k->httpcode < 200; k->http_bodyless = k->httpcode >= 100 && k->httpcode < 200;
@ -3918,7 +3918,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
/* Switching Protocols */ /* Switching Protocols */
if(k->upgr101 == UPGR101_REQUESTED) { if(k->upgr101 == UPGR101_REQUESTED) {
/* Switching to HTTP/2 */ /* Switching to HTTP/2 */
infof(data, "Received 101\n"); infof(data, "Received 101");
k->upgr101 = UPGR101_RECEIVED; k->upgr101 = UPGR101_RECEIVED;
/* we'll get more headers (HTTP/2 response) */ /* we'll get more headers (HTTP/2 response) */
@ -3958,7 +3958,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
assume that the server will close the connection to assume that the server will close the connection to
signal the end of the document. */ signal the end of the document. */
infof(data, "no chunk, no close, no size. Assume close to " infof(data, "no chunk, no close, no size. Assume close to "
"signal end\n"); "signal end");
streamclose(conn, "HTTP: No end-of-message indicator"); streamclose(conn, "HTTP: No end-of-message indicator");
} }
} }
@ -3971,7 +3971,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
(conn->http_ntlm_state == NTLMSTATE_TYPE2)) || (conn->http_ntlm_state == NTLMSTATE_TYPE2)) ||
((data->req.httpcode == 407) && ((data->req.httpcode == 407) &&
(conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) { (conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) {
infof(data, "Connection closure while negotiating auth (HTTP 1.0?)\n"); infof(data, "Connection closure while negotiating auth (HTTP 1.0?)");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
#endif #endif
@ -3981,7 +3981,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
(conn->http_negotiate_state == GSS_AUTHRECV)) || (conn->http_negotiate_state == GSS_AUTHRECV)) ||
((data->req.httpcode == 407) && ((data->req.httpcode == 407) &&
(conn->proxy_negotiate_state == GSS_AUTHRECV)))) { (conn->proxy_negotiate_state == GSS_AUTHRECV)))) {
infof(data, "Connection closure while negotiating auth (HTTP 1.0?)\n"); infof(data, "Connection closure while negotiating auth (HTTP 1.0?)");
data->state.authproblem = TRUE; data->state.authproblem = TRUE;
} }
if((conn->http_negotiate_state == GSS_AUTHDONE) && if((conn->http_negotiate_state == GSS_AUTHDONE) &&
@ -4061,21 +4061,21 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
if((k->httpcode == 417) && data->state.expect100header) { if((k->httpcode == 417) && data->state.expect100header) {
/* 417 Expectation Failed - try again without the Expect /* 417 Expectation Failed - try again without the Expect
header */ header */
infof(data, "Got 417 while waiting for a 100\n"); infof(data, "Got 417 while waiting for a 100");
data->state.disableexpect = TRUE; data->state.disableexpect = TRUE;
DEBUGASSERT(!data->req.newurl); DEBUGASSERT(!data->req.newurl);
data->req.newurl = strdup(data->state.url); data->req.newurl = strdup(data->state.url);
Curl_done_sending(data, k); Curl_done_sending(data, k);
} }
else if(data->set.http_keep_sending_on_error) { else if(data->set.http_keep_sending_on_error) {
infof(data, "HTTP error before end of send, keep sending\n"); infof(data, "HTTP error before end of send, keep sending");
if(k->exp100 > EXP100_SEND_DATA) { if(k->exp100 > EXP100_SEND_DATA) {
k->exp100 = EXP100_SEND_DATA; k->exp100 = EXP100_SEND_DATA;
k->keepon |= KEEP_SEND; k->keepon |= KEEP_SEND;
} }
} }
else { else {
infof(data, "HTTP error before end of send, stop sending\n"); infof(data, "HTTP error before end of send, stop sending");
streamclose(conn, "Stop sending data before everything sent"); streamclose(conn, "Stop sending data before everything sent");
result = Curl_done_sending(data, k); result = Curl_done_sending(data, k);
if(result) if(result)
@ -4095,7 +4095,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
if(conn->bits.rewindaftersend) { if(conn->bits.rewindaftersend) {
/* We rewind after a complete send, so thus we continue /* We rewind after a complete send, so thus we continue
sending now */ sending now */
infof(data, "Keep sending data to get tossed away!\n"); infof(data, "Keep sending data to get tossed away!");
k->keepon |= KEEP_SEND; k->keepon |= KEEP_SEND;
} }
} }
@ -4250,11 +4250,11 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
if(k->upgr101 == UPGR101_RECEIVED) { if(k->upgr101 == UPGR101_RECEIVED) {
/* supposedly upgraded to http2 now */ /* supposedly upgraded to http2 now */
if(conn->httpversion != 20) if(conn->httpversion != 20)
infof(data, "Lying server, not serving HTTP/2\n"); infof(data, "Lying server, not serving HTTP/2");
} }
if(conn->httpversion < 20) { if(conn->httpversion < 20) {
conn->bundle->multiuse = BUNDLE_NO_MULTIUSE; conn->bundle->multiuse = BUNDLE_NO_MULTIUSE;
infof(data, "Mark bundle as not supporting multiuse\n"); infof(data, "Mark bundle as not supporting multiuse");
} }
} }
else if(!nc) { else if(!nc) {

View File

@ -146,12 +146,12 @@ static CURLcode http2_disconnect(struct Curl_easy *data,
(void)data; (void)data;
#endif #endif
H2BUGF(infof(data, "HTTP/2 DISCONNECT starts now\n")); H2BUGF(infof(data, "HTTP/2 DISCONNECT starts now"));
nghttp2_session_del(c->h2); nghttp2_session_del(c->h2);
Curl_safefree(c->inbuf); Curl_safefree(c->inbuf);
H2BUGF(infof(data, "HTTP/2 DISCONNECT done\n")); H2BUGF(infof(data, "HTTP/2 DISCONNECT done"));
return CURLE_OK; return CURLE_OK;
} }
@ -196,7 +196,7 @@ static bool http2_connisdead(struct Curl_easy *data, struct connectdata *conn)
data, FIRSTSOCKET, httpc->inbuf, H2_BUFSIZE, &result); data, FIRSTSOCKET, httpc->inbuf, H2_BUFSIZE, &result);
if(nread != -1) { if(nread != -1) {
infof(data, infof(data,
"%d bytes stray data read before trying h2 connection\n", "%d bytes stray data read before trying h2 connection",
(int)nread); (int)nread);
httpc->nread_inbuf = 0; httpc->nread_inbuf = 0;
httpc->inbuflen = nread; httpc->inbuflen = nread;
@ -552,7 +552,7 @@ static int push_promise(struct Curl_easy *data,
const nghttp2_push_promise *frame) const nghttp2_push_promise *frame)
{ {
int rv; /* one of the CURL_PUSH_* defines */ int rv; /* one of the CURL_PUSH_* defines */
H2BUGF(infof(data, "PUSH_PROMISE received, stream %u!\n", H2BUGF(infof(data, "PUSH_PROMISE received, stream %u!",
frame->promised_stream_id)); frame->promised_stream_id));
if(data->multi->push_cb) { if(data->multi->push_cb) {
struct HTTP *stream; struct HTTP *stream;
@ -564,7 +564,7 @@ static int push_promise(struct Curl_easy *data,
/* clone the parent */ /* clone the parent */
struct Curl_easy *newhandle = duphandle(data); struct Curl_easy *newhandle = duphandle(data);
if(!newhandle) { if(!newhandle) {
infof(data, "failed to duplicate handle\n"); infof(data, "failed to duplicate handle");
rv = CURL_PUSH_DENY; /* FAIL HARD */ rv = CURL_PUSH_DENY; /* FAIL HARD */
goto fail; goto fail;
} }
@ -572,7 +572,7 @@ static int push_promise(struct Curl_easy *data,
heads.data = data; heads.data = data;
heads.frame = frame; heads.frame = frame;
/* ask the application */ /* ask the application */
H2BUGF(infof(data, "Got PUSH_PROMISE, ask application!\n")); H2BUGF(infof(data, "Got PUSH_PROMISE, ask application!"));
stream = data->req.p.http; stream = data->req.p.http;
if(!stream) { if(!stream) {
@ -620,7 +620,7 @@ static int push_promise(struct Curl_easy *data,
state with the given connection !*/ state with the given connection !*/
rc = Curl_multi_add_perform(data->multi, newhandle, conn); rc = Curl_multi_add_perform(data->multi, newhandle, conn);
if(rc) { if(rc) {
infof(data, "failed to add handle to multi\n"); infof(data, "failed to add handle to multi");
http2_stream_free(newhandle->req.p.http); http2_stream_free(newhandle->req.p.http);
newhandle->req.p.http = NULL; newhandle->req.p.http = NULL;
Curl_close(&newhandle); Curl_close(&newhandle);
@ -633,7 +633,7 @@ static int push_promise(struct Curl_easy *data,
frame->promised_stream_id, frame->promised_stream_id,
newhandle); newhandle);
if(rv) { if(rv) {
infof(data, "failed to set user_data for stream %d\n", infof(data, "failed to set user_data for stream %d",
frame->promised_stream_id); frame->promised_stream_id);
DEBUGASSERT(0); DEBUGASSERT(0);
rv = CURL_PUSH_DENY; rv = CURL_PUSH_DENY;
@ -643,7 +643,7 @@ static int push_promise(struct Curl_easy *data,
Curl_dyn_init(&newstream->trailer_recvbuf, DYN_H2_TRAILERS); Curl_dyn_init(&newstream->trailer_recvbuf, DYN_H2_TRAILERS);
} }
else { else {
H2BUGF(infof(data, "Got PUSH_PROMISE, ignore it!\n")); H2BUGF(infof(data, "Got PUSH_PROMISE, ignore it!"));
rv = CURL_PUSH_DENY; rv = CURL_PUSH_DENY;
} }
fail: fail:
@ -679,21 +679,21 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
/* stream ID zero is for connection-oriented stuff */ /* stream ID zero is for connection-oriented stuff */
if(frame->hd.type == NGHTTP2_SETTINGS) { if(frame->hd.type == NGHTTP2_SETTINGS) {
uint32_t max_conn = httpc->settings.max_concurrent_streams; uint32_t max_conn = httpc->settings.max_concurrent_streams;
H2BUGF(infof(data, "Got SETTINGS\n")); H2BUGF(infof(data, "Got SETTINGS"));
httpc->settings.max_concurrent_streams = httpc->settings.max_concurrent_streams =
nghttp2_session_get_remote_settings( nghttp2_session_get_remote_settings(
session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS); session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS);
httpc->settings.enable_push = httpc->settings.enable_push =
nghttp2_session_get_remote_settings( nghttp2_session_get_remote_settings(
session, NGHTTP2_SETTINGS_ENABLE_PUSH); session, NGHTTP2_SETTINGS_ENABLE_PUSH);
H2BUGF(infof(data, "MAX_CONCURRENT_STREAMS == %d\n", H2BUGF(infof(data, "MAX_CONCURRENT_STREAMS == %d",
httpc->settings.max_concurrent_streams)); httpc->settings.max_concurrent_streams));
H2BUGF(infof(data, "ENABLE_PUSH == %s\n", H2BUGF(infof(data, "ENABLE_PUSH == %s",
httpc->settings.enable_push?"TRUE":"false")); httpc->settings.enable_push?"TRUE":"false"));
if(max_conn != httpc->settings.max_concurrent_streams) { if(max_conn != httpc->settings.max_concurrent_streams) {
/* only signal change if the value actually changed */ /* only signal change if the value actually changed */
infof(data, infof(data,
"Connection state changed (MAX_CONCURRENT_STREAMS == %u)!\n", "Connection state changed (MAX_CONCURRENT_STREAMS == %u)!",
httpc->settings.max_concurrent_streams); httpc->settings.max_concurrent_streams);
multi_connchanged(data->multi); multi_connchanged(data->multi);
} }
@ -703,19 +703,19 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
data_s = nghttp2_session_get_stream_user_data(session, stream_id); data_s = nghttp2_session_get_stream_user_data(session, stream_id);
if(!data_s) { if(!data_s) {
H2BUGF(infof(data, H2BUGF(infof(data,
"No Curl_easy associated with stream: %x\n", "No Curl_easy associated with stream: %x",
stream_id)); stream_id));
return 0; return 0;
} }
stream = data_s->req.p.http; stream = data_s->req.p.http;
if(!stream) { if(!stream) {
H2BUGF(infof(data_s, "No proto pointer for stream: %x\n", H2BUGF(infof(data_s, "No proto pointer for stream: %x",
stream_id)); stream_id));
return NGHTTP2_ERR_CALLBACK_FAILURE; return NGHTTP2_ERR_CALLBACK_FAILURE;
} }
H2BUGF(infof(data_s, "on_frame_recv() header %x stream %x\n", H2BUGF(infof(data_s, "on_frame_recv() header %x stream %x",
frame->hd.type, stream_id)); frame->hd.type, stream_id));
switch(frame->hd.type) { switch(frame->hd.type) {
@ -763,7 +763,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
ncopy); ncopy);
stream->nread_header_recvbuf += ncopy; stream->nread_header_recvbuf += ncopy;
H2BUGF(infof(data_s, "Store %zu bytes headers from stream %u at %p\n", H2BUGF(infof(data_s, "Store %zu bytes headers from stream %u at %p",
ncopy, stream_id, stream->mem)); ncopy, stream_id, stream->mem));
stream->len -= ncopy; stream->len -= ncopy;
@ -785,13 +785,13 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
if(nghttp2_is_fatal(h2)) if(nghttp2_is_fatal(h2))
return NGHTTP2_ERR_CALLBACK_FAILURE; return NGHTTP2_ERR_CALLBACK_FAILURE;
else if(rv == CURL_PUSH_ERROROUT) { else if(rv == CURL_PUSH_ERROROUT) {
DEBUGF(infof(data_s, "Fail the parent stream (too)\n")); DEBUGF(infof(data_s, "Fail the parent stream (too)"));
return NGHTTP2_ERR_CALLBACK_FAILURE; return NGHTTP2_ERR_CALLBACK_FAILURE;
} }
} }
break; break;
default: default:
H2BUGF(infof(data_s, "Got frame type %x for stream %u!\n", H2BUGF(infof(data_s, "Got frame type %x for stream %u!",
frame->hd.type, stream_id)); frame->hd.type, stream_id));
break; break;
} }
@ -836,7 +836,7 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
Curl_expire(data_s, 0, EXPIRE_RUN_NOW); Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
H2BUGF(infof(data_s, "%zu data received for stream %u " H2BUGF(infof(data_s, "%zu data received for stream %u "
"(%zu left in buffer %p, total %zu)\n", "(%zu left in buffer %p, total %zu)",
nread, stream_id, nread, stream_id,
stream->len, stream->mem, stream->len, stream->mem,
stream->memlen)); stream->memlen));
@ -845,7 +845,7 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
stream->pausedata = mem + nread; stream->pausedata = mem + nread;
stream->pauselen = len - nread; stream->pauselen = len - nread;
H2BUGF(infof(data_s, "NGHTTP2_ERR_PAUSE - %zu bytes out of buffer" H2BUGF(infof(data_s, "NGHTTP2_ERR_PAUSE - %zu bytes out of buffer"
", stream %u\n", ", stream %u",
len - nread, stream_id)); len - nread, stream_id));
data_s->conn->proto.httpc.pause_stream_id = stream_id; data_s->conn->proto.httpc.pause_stream_id = stream_id;
@ -883,7 +883,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id,
decided to reject stream (e.g., PUSH_PROMISE). */ decided to reject stream (e.g., PUSH_PROMISE). */
return 0; return 0;
} }
H2BUGF(infof(data_s, "on_stream_close(), %s (err %d), stream %u\n", H2BUGF(infof(data_s, "on_stream_close(), %s (err %d), stream %u",
nghttp2_http2_strerror(error_code), error_code, stream_id)); nghttp2_http2_strerror(error_code), error_code, stream_id));
stream = data_s->req.p.http; stream = data_s->req.p.http;
if(!stream) if(!stream)
@ -898,15 +898,15 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id,
/* remove the entry from the hash as the stream is now gone */ /* remove the entry from the hash as the stream is now gone */
rv = nghttp2_session_set_stream_user_data(session, stream_id, 0); rv = nghttp2_session_set_stream_user_data(session, stream_id, 0);
if(rv) { if(rv) {
infof(data_s, "http/2: failed to clear user_data for stream %d!\n", infof(data_s, "http/2: failed to clear user_data for stream %d!",
stream_id); stream_id);
DEBUGASSERT(0); DEBUGASSERT(0);
} }
if(stream_id == httpc->pause_stream_id) { if(stream_id == httpc->pause_stream_id) {
H2BUGF(infof(data_s, "Stopped the pause stream!\n")); H2BUGF(infof(data_s, "Stopped the pause stream!"));
httpc->pause_stream_id = 0; httpc->pause_stream_id = 0;
} }
H2BUGF(infof(data_s, "Removed stream %u hash!\n", stream_id)); H2BUGF(infof(data_s, "Removed stream %u hash!", stream_id));
stream->stream_id = 0; /* cleared */ stream->stream_id = 0; /* cleared */
} }
return 0; return 0;
@ -924,7 +924,7 @@ static int on_begin_headers(nghttp2_session *session,
return 0; return 0;
} }
H2BUGF(infof(data_s, "on_begin_headers() was called\n")); H2BUGF(infof(data_s, "on_begin_headers() was called"));
if(frame->hd.type != NGHTTP2_HEADERS) { if(frame->hd.type != NGHTTP2_HEADERS) {
return 0; return 0;
@ -1052,7 +1052,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
if(stream->bodystarted) { if(stream->bodystarted) {
/* This is a trailer */ /* This is a trailer */
H2BUGF(infof(data_s, "h2 trailer: %.*s: %.*s\n", namelen, name, valuelen, H2BUGF(infof(data_s, "h2 trailer: %.*s: %.*s", namelen, name, valuelen,
value)); value));
result = Curl_dyn_addf(&stream->trailer_recvbuf, result = Curl_dyn_addf(&stream->trailer_recvbuf,
"%.*s: %.*s\r\n", namelen, name, "%.*s: %.*s\r\n", namelen, name,
@ -1085,7 +1085,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
if(get_transfer(httpc) != data_s) if(get_transfer(httpc) != data_s)
Curl_expire(data_s, 0, EXPIRE_RUN_NOW); Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
H2BUGF(infof(data_s, "h2 status: HTTP/2 %03d (easy %p)\n", H2BUGF(infof(data_s, "h2 status: HTTP/2 %03d (easy %p)",
stream->status_code, data_s)); stream->status_code, data_s));
return 0; return 0;
} }
@ -1109,7 +1109,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
if(get_transfer(httpc) != data_s) if(get_transfer(httpc) != data_s)
Curl_expire(data_s, 0, EXPIRE_RUN_NOW); Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
H2BUGF(infof(data_s, "h2 header: %.*s: %.*s\n", namelen, name, valuelen, H2BUGF(infof(data_s, "h2 header: %.*s: %.*s", namelen, name, valuelen,
value)); value));
return 0; /* 0 is successful */ return 0; /* 0 is successful */
@ -1159,7 +1159,7 @@ static ssize_t data_source_read_callback(nghttp2_session *session,
return NGHTTP2_ERR_DEFERRED; return NGHTTP2_ERR_DEFERRED;
H2BUGF(infof(data_s, "data_source_read_callback: " H2BUGF(infof(data_s, "data_source_read_callback: "
"returns %zu bytes stream %u\n", "returns %zu bytes stream %u",
nread, stream_id)); nread, stream_id));
return nread; return nread;
@ -1226,7 +1226,7 @@ void Curl_http2_done(struct Curl_easy *data, bool premature)
(void)nghttp2_session_send(httpc->h2); (void)nghttp2_session_send(httpc->h2);
if(http->stream_id == httpc->pause_stream_id) { if(http->stream_id == httpc->pause_stream_id) {
infof(data, "stopped the pause stream!\n"); infof(data, "stopped the pause stream!");
httpc->pause_stream_id = 0; httpc->pause_stream_id = 0;
} }
} }
@ -1239,7 +1239,7 @@ void Curl_http2_done(struct Curl_easy *data, bool premature)
int rv = nghttp2_session_set_stream_user_data(httpc->h2, int rv = nghttp2_session_set_stream_user_data(httpc->h2,
http->stream_id, 0); http->stream_id, 0);
if(rv) { if(rv) {
infof(data, "http/2: failed to clear user_data for stream %d!\n", infof(data, "http/2: failed to clear user_data for stream %d!",
http->stream_id); http->stream_id);
DEBUGASSERT(0); DEBUGASSERT(0);
} }
@ -1386,7 +1386,7 @@ static int h2_process_pending_input(struct Curl_easy *data,
if(nread == rv) { if(nread == rv) {
H2BUGF(infof(data, H2BUGF(infof(data,
"h2_process_pending_input: All data in connection buffer " "h2_process_pending_input: All data in connection buffer "
"processed\n")); "processed"));
httpc->inbuflen = 0; httpc->inbuflen = 0;
httpc->nread_inbuf = 0; httpc->nread_inbuf = 0;
} }
@ -1394,7 +1394,7 @@ static int h2_process_pending_input(struct Curl_easy *data,
httpc->nread_inbuf += rv; httpc->nread_inbuf += rv;
H2BUGF(infof(data, H2BUGF(infof(data,
"h2_process_pending_input: %zu bytes left in connection " "h2_process_pending_input: %zu bytes left in connection "
"buffer\n", "buffer",
httpc->inbuflen - httpc->nread_inbuf)); httpc->inbuflen - httpc->nread_inbuf));
} }
@ -1415,7 +1415,7 @@ static int h2_process_pending_input(struct Curl_easy *data,
if(should_close_session(httpc)) { if(should_close_session(httpc)) {
struct HTTP *stream = data->req.p.http; struct HTTP *stream = data->req.p.http;
H2BUGF(infof(data, H2BUGF(infof(data,
"h2_process_pending_input: nothing to do in this session\n")); "h2_process_pending_input: nothing to do in this session"));
if(stream->error) if(stream->error)
*err = CURLE_HTTP2; *err = CURLE_HTTP2;
else { else {
@ -1459,7 +1459,7 @@ CURLcode Curl_http2_done_sending(struct Curl_easy *data,
struct SingleRequest *k = &data->req; struct SingleRequest *k = &data->req;
int rv; int rv;
H2BUGF(infof(data, "HTTP/2 still wants to send data (easy %p)\n", data)); H2BUGF(infof(data, "HTTP/2 still wants to send data (easy %p)", data));
/* and attempt to send the pending frames */ /* and attempt to send the pending frames */
rv = h2_session_send(data, h2); rv = h2_session_send(data, h2);
@ -1498,7 +1498,7 @@ static ssize_t http2_handle_stream_close(struct connectdata *conn,
/* Reset to FALSE to prevent infinite loop in readwrite_data function. */ /* Reset to FALSE to prevent infinite loop in readwrite_data function. */
stream->closed = FALSE; stream->closed = FALSE;
if(stream->error == NGHTTP2_REFUSED_STREAM) { if(stream->error == NGHTTP2_REFUSED_STREAM) {
H2BUGF(infof(data, "REFUSED_STREAM (%d), try again on a new connection!\n", H2BUGF(infof(data, "REFUSED_STREAM (%d), try again on a new connection!",
stream->stream_id)); stream->stream_id));
connclose(conn, "REFUSED_STREAM"); /* don't use this anymore */ connclose(conn, "REFUSED_STREAM"); /* don't use this anymore */
data->state.refused_stream = TRUE; data->state.refused_stream = TRUE;
@ -1547,7 +1547,7 @@ static ssize_t http2_handle_stream_close(struct connectdata *conn,
stream->close_handled = TRUE; stream->close_handled = TRUE;
H2BUGF(infof(data, "http2_recv returns 0, http2_handle_stream_close\n")); H2BUGF(infof(data, "http2_recv returns 0, http2_handle_stream_close"));
return 0; return 0;
} }
@ -1590,7 +1590,7 @@ static int h2_session_send(struct Curl_easy *data,
h2_pri_spec(data, &pri_spec); h2_pri_spec(data, &pri_spec);
H2BUGF(infof(data, "Queuing PRIORITY on stream %u (easy %p)\n", H2BUGF(infof(data, "Queuing PRIORITY on stream %u (easy %p)",
stream->stream_id, data)); stream->stream_id, data));
DEBUGASSERT(stream->stream_id != -1); DEBUGASSERT(stream->stream_id != -1);
rv = nghttp2_submit_priority(h2, NGHTTP2_FLAG_NONE, stream->stream_id, rv = nghttp2_submit_priority(h2, NGHTTP2_FLAG_NONE, stream->stream_id,
@ -1614,7 +1614,7 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
if(should_close_session(httpc)) { if(should_close_session(httpc)) {
H2BUGF(infof(data, H2BUGF(infof(data,
"http2_recv: nothing to do in this session\n")); "http2_recv: nothing to do in this session"));
if(conn->bits.close) { if(conn->bits.close) {
/* already marked for closure, return OK and we're done */ /* already marked for closure, return OK and we're done */
*err = CURLE_OK; *err = CURLE_OK;
@ -1648,12 +1648,12 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
stream->nread_header_recvbuf, ncopy); stream->nread_header_recvbuf, ncopy);
stream->nread_header_recvbuf += ncopy; stream->nread_header_recvbuf += ncopy;
H2BUGF(infof(data, "http2_recv: Got %d bytes from header_recvbuf\n", H2BUGF(infof(data, "http2_recv: Got %d bytes from header_recvbuf",
(int)ncopy)); (int)ncopy));
return ncopy; return ncopy;
} }
H2BUGF(infof(data, "http2_recv: easy %p (stream %u) win %u/%u\n", H2BUGF(infof(data, "http2_recv: easy %p (stream %u) win %u/%u",
data, stream->stream_id, data, stream->stream_id,
nghttp2_session_get_local_window_size(httpc->h2), nghttp2_session_get_local_window_size(httpc->h2),
nghttp2_session_get_stream_local_window_size(httpc->h2, nghttp2_session_get_stream_local_window_size(httpc->h2,
@ -1661,7 +1661,7 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
)); ));
if((data->state.drain) && stream->memlen) { if((data->state.drain) && stream->memlen) {
H2BUGF(infof(data, "http2_recv: DRAIN %zu bytes stream %u!! (%p => %p)\n", H2BUGF(infof(data, "http2_recv: DRAIN %zu bytes stream %u!! (%p => %p)",
stream->memlen, stream->stream_id, stream->memlen, stream->stream_id,
stream->mem, mem)); stream->mem, mem));
if(mem != stream->mem) { if(mem != stream->mem) {
@ -1689,7 +1689,7 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
stream->pauselen -= nread; stream->pauselen -= nread;
if(stream->pauselen == 0) { if(stream->pauselen == 0) {
H2BUGF(infof(data, "Unpaused by stream %u\n", stream->stream_id)); H2BUGF(infof(data, "Unpaused by stream %u", stream->stream_id));
DEBUGASSERT(httpc->pause_stream_id == stream->stream_id); DEBUGASSERT(httpc->pause_stream_id == stream->stream_id);
httpc->pause_stream_id = 0; httpc->pause_stream_id = 0;
@ -1707,7 +1707,7 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
return -1; return -1;
} }
} }
H2BUGF(infof(data, "http2_recv: returns unpaused %zd bytes on stream %u\n", H2BUGF(infof(data, "http2_recv: returns unpaused %zd bytes on stream %u",
nread, stream->stream_id)); nread, stream->stream_id));
return nread; return nread;
} }
@ -1723,7 +1723,7 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
if(stream->closed) if(stream->closed)
/* closed overrides paused */ /* closed overrides paused */
return 0; return 0;
H2BUGF(infof(data, "stream %x is paused, pause id: %x\n", H2BUGF(infof(data, "stream %x is paused, pause id: %x",
stream->stream_id, httpc->pause_stream_id)); stream->stream_id, httpc->pause_stream_id));
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
return -1; return -1;
@ -1761,12 +1761,12 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
return -1; return -1;
} }
H2BUGF(infof(data, "end of stream\n")); H2BUGF(infof(data, "end of stream"));
*err = CURLE_OK; *err = CURLE_OK;
return 0; return 0;
} }
H2BUGF(infof(data, "nread=%zd\n", nread)); H2BUGF(infof(data, "nread=%zd", nread));
httpc->inbuflen = nread; httpc->inbuflen = nread;
@ -1775,7 +1775,7 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
else { else {
nread = httpc->inbuflen - httpc->nread_inbuf; nread = httpc->inbuflen - httpc->nread_inbuf;
(void)nread; /* silence warning, used in debug */ (void)nread; /* silence warning, used in debug */
H2BUGF(infof(data, "Use data left in connection buffer, nread=%zd\n", H2BUGF(infof(data, "Use data left in connection buffer, nread=%zd",
nread)); nread));
} }
@ -1784,14 +1784,14 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
} }
if(stream->memlen) { if(stream->memlen) {
ssize_t retlen = stream->memlen; ssize_t retlen = stream->memlen;
H2BUGF(infof(data, "http2_recv: returns %zd for stream %u\n", H2BUGF(infof(data, "http2_recv: returns %zd for stream %u",
retlen, stream->stream_id)); retlen, stream->stream_id));
stream->memlen = 0; stream->memlen = 0;
if(httpc->pause_stream_id == stream->stream_id) { if(httpc->pause_stream_id == stream->stream_id) {
/* data for this stream is returned now, but this stream caused a pause /* data for this stream is returned now, but this stream caused a pause
already so we need it called again asap */ already so we need it called again asap */
H2BUGF(infof(data, "Data returned for PAUSED stream %u\n", H2BUGF(infof(data, "Data returned for PAUSED stream %u",
stream->stream_id)); stream->stream_id));
} }
else if(!stream->closed) { else if(!stream->closed) {
@ -1806,7 +1806,7 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex,
if(stream->closed) if(stream->closed)
return http2_handle_stream_close(conn, data, stream, err); return http2_handle_stream_close(conn, data, stream, err);
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
H2BUGF(infof(data, "http2_recv returns AGAIN for stream %u\n", H2BUGF(infof(data, "http2_recv returns AGAIN for stream %u",
stream->stream_id)); stream->stream_id));
return -1; return -1;
} }
@ -1910,11 +1910,11 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
(void)sockindex; (void)sockindex;
H2BUGF(infof(data, "http2_send len=%zu\n", len)); H2BUGF(infof(data, "http2_send len=%zu", len));
if(stream->stream_id != -1) { if(stream->stream_id != -1) {
if(stream->close_handled) { if(stream->close_handled) {
infof(data, "stream %d closed\n", stream->stream_id); infof(data, "stream %d closed", stream->stream_id);
*err = CURLE_HTTP2_STREAM; *err = CURLE_HTTP2_STREAM;
return -1; return -1;
} }
@ -1943,7 +1943,7 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
stream->upload_len = 0; stream->upload_len = 0;
if(should_close_session(httpc)) { if(should_close_session(httpc)) {
H2BUGF(infof(data, "http2_send: nothing to do in this session\n")); H2BUGF(infof(data, "http2_send: nothing to do in this session"));
*err = CURLE_HTTP2; *err = CURLE_HTTP2;
return -1; return -1;
} }
@ -1956,7 +1956,7 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
nghttp2_session_resume_data(h2, stream->stream_id); nghttp2_session_resume_data(h2, stream->stream_id);
} }
H2BUGF(infof(data, "http2_send returns %zu for stream %u\n", len, H2BUGF(infof(data, "http2_send returns %zu for stream %u", len,
stream->stream_id)); stream->stream_id));
return len; return len;
} }
@ -2119,7 +2119,7 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
for(i = 0; i < nheader; ++i) { for(i = 0; i < nheader; ++i) {
acc += nva[i].namelen + nva[i].valuelen; acc += nva[i].namelen + nva[i].valuelen;
H2BUGF(infof(data, "h2 header: %.*s:%.*s\n", H2BUGF(infof(data, "h2 header: %.*s:%.*s",
nva[i].namelen, nva[i].name, nva[i].namelen, nva[i].name,
nva[i].valuelen, nva[i].value)); nva[i].valuelen, nva[i].value));
} }
@ -2127,13 +2127,13 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
if(acc > MAX_ACC) { if(acc > MAX_ACC) {
infof(data, "http2_send: Warning: The cumulative length of all " infof(data, "http2_send: Warning: The cumulative length of all "
"headers exceeds %d bytes and that could cause the " "headers exceeds %d bytes and that could cause the "
"stream to be rejected.\n", MAX_ACC); "stream to be rejected.", MAX_ACC);
} }
} }
h2_pri_spec(data, &pri_spec); h2_pri_spec(data, &pri_spec);
H2BUGF(infof(data, "http2_send request allowed %d (easy handle %p)\n", H2BUGF(infof(data, "http2_send request allowed %d (easy handle %p)",
nghttp2_session_check_request_allowed(h2), (void *)data)); nghttp2_session_check_request_allowed(h2), (void *)data));
switch(data->state.httpreq) { switch(data->state.httpreq) {
@ -2161,20 +2161,20 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
if(stream_id < 0) { if(stream_id < 0) {
H2BUGF(infof(data, H2BUGF(infof(data,
"http2_send() nghttp2_submit_request error (%s)%d\n", "http2_send() nghttp2_submit_request error (%s)%d",
nghttp2_strerror(stream_id), stream_id)); nghttp2_strerror(stream_id), stream_id));
*err = CURLE_SEND_ERROR; *err = CURLE_SEND_ERROR;
return -1; return -1;
} }
infof(data, "Using Stream ID: %x (easy handle %p)\n", infof(data, "Using Stream ID: %x (easy handle %p)",
stream_id, (void *)data); stream_id, (void *)data);
stream->stream_id = stream_id; stream->stream_id = stream_id;
rv = h2_session_send(data, h2); rv = h2_session_send(data, h2);
if(rv) { if(rv) {
H2BUGF(infof(data, H2BUGF(infof(data,
"http2_send() nghttp2_session_send error (%s)%d\n", "http2_send() nghttp2_session_send error (%s)%d",
nghttp2_strerror(rv), rv)); nghttp2_strerror(rv), rv));
*err = CURLE_SEND_ERROR; *err = CURLE_SEND_ERROR;
@ -2182,7 +2182,7 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
} }
if(should_close_session(httpc)) { if(should_close_session(httpc)) {
H2BUGF(infof(data, "http2_send: nothing to do in this session\n")); H2BUGF(infof(data, "http2_send: nothing to do in this session"));
*err = CURLE_HTTP2; *err = CURLE_HTTP2;
return -1; return -1;
} }
@ -2233,7 +2233,7 @@ CURLcode Curl_http2_setup(struct Curl_easy *data,
return result; return result;
} }
infof(data, "Using HTTP2, server supports multiplexing\n"); infof(data, "Using HTTP2, server supports multiplexing");
stream->upload_left = 0; stream->upload_left = 0;
stream->upload_mem = NULL; stream->upload_mem = NULL;
stream->upload_len = 0; stream->upload_len = 0;
@ -2250,7 +2250,7 @@ CURLcode Curl_http2_setup(struct Curl_easy *data,
conn->httpversion = 20; conn->httpversion = 20;
conn->bundle->multiuse = BUNDLE_MULTIPLEX; conn->bundle->multiuse = BUNDLE_MULTIPLEX;
infof(data, "Connection state changed (HTTP/2 confirmed)\n"); infof(data, "Connection state changed (HTTP/2 confirmed)");
multi_connchanged(data->multi); multi_connchanged(data->multi);
return CURLE_OK; return CURLE_OK;
@ -2290,7 +2290,7 @@ CURLcode Curl_http2_switched(struct Curl_easy *data,
stream->stream_id, stream->stream_id,
data); data);
if(rv) { if(rv) {
infof(data, "http/2: failed to set user_data for stream %d!\n", infof(data, "http/2: failed to set user_data for stream %d!",
stream->stream_id); stream->stream_id);
DEBUGASSERT(0); DEBUGASSERT(0);
} }
@ -2330,7 +2330,7 @@ CURLcode Curl_http2_switched(struct Curl_easy *data,
} }
infof(data, "Copying HTTP/2 data in stream buffer to connection buffer" infof(data, "Copying HTTP/2 data in stream buffer to connection buffer"
" after upgrade: len=%zu\n", " after upgrade: len=%zu",
nread); nread);
if(nread) if(nread)
@ -2381,7 +2381,7 @@ CURLcode Curl_http2_stream_pause(struct Curl_easy *data, bool pause)
if(rv) if(rv)
return CURLE_SEND_ERROR; return CURLE_SEND_ERROR;
DEBUGF(infof(data, "Set HTTP/2 window size to %u for stream %u\n", DEBUGF(infof(data, "Set HTTP/2 window size to %u for stream %u",
window, stream->stream_id)); window, stream->stream_id));
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
@ -2390,7 +2390,7 @@ CURLcode Curl_http2_stream_pause(struct Curl_easy *data, bool pause)
uint32_t window2 = uint32_t window2 =
nghttp2_session_get_stream_local_window_size(httpc->h2, nghttp2_session_get_stream_local_window_size(httpc->h2,
stream->stream_id); stream->stream_id);
DEBUGF(infof(data, "HTTP/2 window size is now %u for stream %u\n", DEBUGF(infof(data, "HTTP/2 window size is now %u for stream %u",
window2, stream->stream_id)); window2, stream->stream_id));
} }
#endif #endif

View File

@ -126,7 +126,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
tmp1 = strchr(tmp0, ':'); tmp1 = strchr(tmp0, ':');
len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0); len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0);
if(len < 1) { if(len < 1) {
infof(data, "first provider can't be empty\n"); infof(data, "first provider can't be empty");
ret = CURLE_BAD_FUNCTION_ARGUMENT; ret = CURLE_BAD_FUNCTION_ARGUMENT;
goto fail; goto fail;
} }
@ -145,7 +145,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
tmp1 = strchr(tmp0, ':'); tmp1 = strchr(tmp0, ':');
len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0); len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0);
if(len < 1) { if(len < 1) {
infof(data, "second provider can't be empty\n"); infof(data, "second provider can't be empty");
ret = CURLE_BAD_FUNCTION_ARGUMENT; ret = CURLE_BAD_FUNCTION_ARGUMENT;
goto fail; goto fail;
} }
@ -165,7 +165,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
tmp1 = strchr(tmp0, ':'); tmp1 = strchr(tmp0, ':');
len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0); len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0);
if(len < 1) { if(len < 1) {
infof(data, "region can't be empty\n"); infof(data, "region can't be empty");
ret = CURLE_BAD_FUNCTION_ARGUMENT; ret = CURLE_BAD_FUNCTION_ARGUMENT;
goto fail; goto fail;
} }
@ -182,7 +182,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
goto fail; goto fail;
} }
if(strlen(service) < 1) { if(strlen(service) < 1) {
infof(data, "service can't be empty\n"); infof(data, "service can't be empty");
ret = CURLE_BAD_FUNCTION_ARGUMENT; ret = CURLE_BAD_FUNCTION_ARGUMENT;
goto fail; goto fail;
} }
@ -203,7 +203,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
tmp1 = strchr(tmp0, '.'); tmp1 = strchr(tmp0, '.');
len = tmp1 - tmp0; len = tmp1 - tmp0;
if(!tmp1 || len < 1) { if(!tmp1 || len < 1) {
infof(data, "service missing in parameters or hostname\n"); infof(data, "service missing in parameters or hostname");
ret = CURLE_URL_MALFORMAT; ret = CURLE_URL_MALFORMAT;
goto fail; goto fail;
} }
@ -218,7 +218,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
tmp1 = strchr(tmp0, '.'); tmp1 = strchr(tmp0, '.');
len = tmp1 - tmp0; len = tmp1 - tmp0;
if(!tmp1 || len < 1) { if(!tmp1 || len < 1) {
infof(data, "region missing in parameters or hostname\n"); infof(data, "region missing in parameters or hostname");
ret = CURLE_URL_MALFORMAT; ret = CURLE_URL_MALFORMAT;
goto fail; goto fail;
} }

View File

@ -89,7 +89,7 @@ CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn,
neg_ctx->havenegdata = len != 0; neg_ctx->havenegdata = len != 0;
if(!len) { if(!len) {
if(state == GSS_AUTHSUCC) { if(state == GSS_AUTHSUCC) {
infof(data, "Negotiate auth restarted\n"); infof(data, "Negotiate auth restarted");
Curl_http_auth_cleanup_negotiate(conn); Curl_http_auth_cleanup_negotiate(conn);
} }
else if(state != GSS_AUTHNONE) { else if(state != GSS_AUTHNONE) {
@ -142,11 +142,11 @@ CURLcode Curl_output_negotiate(struct Curl_easy *data,
} }
if(neg_ctx->noauthpersist || if(neg_ctx->noauthpersist ||
(*state != GSS_AUTHDONE && *state != GSS_AUTHSUCC)) { (*state != GSS_AUTHDONE && *state != GSS_AUTHSUCC)) {
if(neg_ctx->noauthpersist && *state == GSS_AUTHSUCC) { if(neg_ctx->noauthpersist && *state == GSS_AUTHSUCC) {
infof(data, "Curl_output_negotiate, " infof(data, "Curl_output_negotiate, "
"no persistent authentication: cleanup existing context"); "no persistent authentication: cleanup existing context");
Curl_http_auth_cleanup_negotiate(conn); Curl_http_auth_cleanup_negotiate(conn);
} }
if(!neg_ctx->context) { if(!neg_ctx->context) {

View File

@ -100,17 +100,17 @@ CURLcode Curl_input_ntlm(struct Curl_easy *data,
} }
else { else {
if(*state == NTLMSTATE_LAST) { if(*state == NTLMSTATE_LAST) {
infof(data, "NTLM auth restarted\n"); infof(data, "NTLM auth restarted");
Curl_http_auth_cleanup_ntlm(conn); Curl_http_auth_cleanup_ntlm(conn);
} }
else if(*state == NTLMSTATE_TYPE3) { else if(*state == NTLMSTATE_TYPE3) {
infof(data, "NTLM handshake rejected\n"); infof(data, "NTLM handshake rejected");
Curl_http_auth_cleanup_ntlm(conn); Curl_http_auth_cleanup_ntlm(conn);
*state = NTLMSTATE_NONE; *state = NTLMSTATE_NONE;
return CURLE_REMOTE_ACCESS_DENIED; return CURLE_REMOTE_ACCESS_DENIED;
} }
else if(*state >= NTLMSTATE_TYPE1) { else if(*state >= NTLMSTATE_TYPE1) {
infof(data, "NTLM handshake failure (internal error)\n"); infof(data, "NTLM handshake failure (internal error)");
return CURLE_REMOTE_ACCESS_DENIED; return CURLE_REMOTE_ACCESS_DENIED;
} }

View File

@ -169,7 +169,7 @@ static CURLcode connect_init(struct Curl_easy *data, bool reinit)
s = calloc(1, sizeof(struct http_connect_state)); s = calloc(1, sizeof(struct http_connect_state));
if(!s) if(!s)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
infof(data, "allocate connect buffer!\n"); infof(data, "allocate connect buffer!");
conn->connect_state = s; conn->connect_state = s;
Curl_dyn_init(&s->rcvbuf, DYN_PROXY_CONNECT_HEADERS); Curl_dyn_init(&s->rcvbuf, DYN_PROXY_CONNECT_HEADERS);
@ -210,7 +210,7 @@ static void connect_done(struct Curl_easy *data)
/* retore the protocol pointer */ /* retore the protocol pointer */
data->req.p.http = s->prot_save; data->req.p.http = s->prot_save;
s->prot_save = NULL; s->prot_save = NULL;
infof(data, "CONNECT phase completed!\n"); infof(data, "CONNECT phase completed!");
} }
} }
@ -278,7 +278,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
char *hostheader = NULL; char *hostheader = NULL;
char *host = NULL; char *host = NULL;
infof(data, "Establish HTTP proxy tunnel to %s:%d\n", infof(data, "Establish HTTP proxy tunnel to %s:%d",
hostname, remote_port); hostname, remote_port);
/* This only happens if we've looped here due to authentication /* This only happens if we've looped here due to authentication
@ -419,7 +419,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
/* proxy auth was requested and there was proxy auth available, /* proxy auth was requested and there was proxy auth available,
then deem this as "mere" proxy disconnect */ then deem this as "mere" proxy disconnect */
conn->bits.proxy_connect_closed = TRUE; conn->bits.proxy_connect_closed = TRUE;
infof(data, "Proxy CONNECT connection closed\n"); infof(data, "Proxy CONNECT connection closed");
} }
else { else {
error = SELECT_ERROR; error = SELECT_ERROR;
@ -454,7 +454,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
r = Curl_httpchunk_read(data, &byte, 1, &tookcareof, &extra); r = Curl_httpchunk_read(data, &byte, 1, &tookcareof, &extra);
if(r == CHUNKE_STOP) { if(r == CHUNKE_STOP) {
/* we're done reading chunks! */ /* we're done reading chunks! */
infof(data, "chunk reading DONE\n"); infof(data, "chunk reading DONE");
s->keepon = KEEPON_DONE; s->keepon = KEEPON_DONE;
/* we did the full CONNECT treatment, go COMPLETE */ /* we did the full CONNECT treatment, go COMPLETE */
s->tunnel_state = TUNNEL_COMPLETE; s->tunnel_state = TUNNEL_COMPLETE;
@ -513,13 +513,13 @@ static CURLcode CONNECT(struct Curl_easy *data,
if(s->cl) { if(s->cl) {
infof(data, "Ignore %" CURL_FORMAT_CURL_OFF_T infof(data, "Ignore %" CURL_FORMAT_CURL_OFF_T
" bytes of response-body\n", s->cl); " bytes of response-body", s->cl);
} }
else if(s->chunked_encoding) { else if(s->chunked_encoding) {
CHUNKcode r; CHUNKcode r;
CURLcode extra; CURLcode extra;
infof(data, "Ignore chunked response-body\n"); infof(data, "Ignore chunked response-body");
/* We set ignorebody true here since the chunked decoder /* We set ignorebody true here since the chunked decoder
function will acknowledge that. Pay attention so that this is function will acknowledge that. Pay attention so that this is
@ -536,7 +536,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
&extra); &extra);
if(r == CHUNKE_STOP) { if(r == CHUNKE_STOP) {
/* we're done reading chunks! */ /* we're done reading chunks! */
infof(data, "chunk reading DONE\n"); infof(data, "chunk reading DONE");
s->keepon = KEEPON_DONE; s->keepon = KEEPON_DONE;
/* we did the full CONNECT treatment, go to COMPLETE */ /* we did the full CONNECT treatment, go to COMPLETE */
s->tunnel_state = TUNNEL_COMPLETE; s->tunnel_state = TUNNEL_COMPLETE;
@ -582,7 +582,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
/* A client MUST ignore any Content-Length or Transfer-Encoding /* A client MUST ignore any Content-Length or Transfer-Encoding
header fields received in a successful response to CONNECT. header fields received in a successful response to CONNECT.
"Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */ "Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */
infof(data, "Ignoring Content-Length in CONNECT %03d response\n", infof(data, "Ignoring Content-Length in CONNECT %03d response",
k->httpcode); k->httpcode);
} }
else { else {
@ -598,11 +598,11 @@ static CURLcode CONNECT(struct Curl_easy *data,
header fields received in a successful response to CONNECT. header fields received in a successful response to CONNECT.
"Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */ "Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */
infof(data, "Ignoring Transfer-Encoding in " infof(data, "Ignoring Transfer-Encoding in "
"CONNECT %03d response\n", k->httpcode); "CONNECT %03d response", k->httpcode);
} }
else if(Curl_compareheader(linep, else if(Curl_compareheader(linep,
"Transfer-Encoding:", "chunked")) { "Transfer-Encoding:", "chunked")) {
infof(data, "CONNECT responded chunked\n"); infof(data, "CONNECT responded chunked");
s->chunked_encoding = TRUE; s->chunked_encoding = TRUE;
/* init our chunky engine */ /* init our chunky engine */
Curl_httpchunk_init(data); Curl_httpchunk_init(data);
@ -660,7 +660,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
if(data->info.httpproxycode/100 != 2) { if(data->info.httpproxycode/100 != 2) {
if(s->close_connection && data->req.newurl) { if(s->close_connection && data->req.newurl) {
conn->bits.proxy_connect_closed = TRUE; conn->bits.proxy_connect_closed = TRUE;
infof(data, "Connect me again please\n"); infof(data, "Connect me again please");
connect_done(data); connect_done(data);
} }
else { else {
@ -695,7 +695,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
data->state.authproxy.done = TRUE; data->state.authproxy.done = TRUE;
data->state.authproxy.multipass = FALSE; data->state.authproxy.multipass = FALSE;
infof(data, "Proxy replied %d to CONNECT request\n", infof(data, "Proxy replied %d to CONNECT request",
data->info.httpproxycode); data->info.httpproxycode);
data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */ data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */
conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the
@ -910,7 +910,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
if(data->info.httpproxycode/100 != 2) { if(data->info.httpproxycode/100 != 2) {
if(conn->bits.close && data->req.newurl) { if(conn->bits.close && data->req.newurl) {
conn->bits.proxy_connect_closed = TRUE; conn->bits.proxy_connect_closed = TRUE;
infof(data, "Connect me again please\n"); infof(data, "Connect me again please");
connect_done(data); connect_done(data);
} }
else { else {

View File

@ -414,7 +414,7 @@ static void state(struct Curl_easy *data, imapstate newstate)
}; };
if(imapc->state != newstate) if(imapc->state != newstate)
infof(data, "IMAP %p state change from %s to %s\n", infof(data, "IMAP %p state change from %s to %s",
(void *)imapc, names[imapc->state], names[newstate]); (void *)imapc, names[imapc->state], names[newstate]);
#endif #endif
@ -606,7 +606,7 @@ static CURLcode imap_perform_authentication(struct Curl_easy *data,
result = imap_perform_login(data, conn); result = imap_perform_login(data, conn);
else { else {
/* Other mechanisms not supported */ /* Other mechanisms not supported */
infof(data, "No known authentication mechanisms supported!\n"); infof(data, "No known authentication mechanisms supported!");
result = CURLE_LOGIN_DENIED; result = CURLE_LOGIN_DENIED;
} }
} }
@ -861,7 +861,7 @@ static CURLcode imap_state_servergreet_resp(struct Curl_easy *data,
/* PREAUTH */ /* PREAUTH */
struct imap_conn *imapc = &conn->proto.imapc; struct imap_conn *imapc = &conn->proto.imapc;
imapc->preauth = TRUE; imapc->preauth = TRUE;
infof(data, "PREAUTH connection, already authenticated!\n"); infof(data, "PREAUTH connection, already authenticated!");
} }
else if(imapcode != IMAP_RESP_OK) { else if(imapcode != IMAP_RESP_OK) {
failf(data, "Got unexpected imap-server response"); failf(data, "Got unexpected imap-server response");
@ -1143,7 +1143,7 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
} }
if(parsed) { if(parsed) {
infof(data, "Found %" CURL_FORMAT_CURL_OFF_T " bytes to download\n", infof(data, "Found %" CURL_FORMAT_CURL_OFF_T " bytes to download",
size); size);
Curl_pgrsSetDownloadSize(data, size); Curl_pgrsSetDownloadSize(data, size);
@ -1169,7 +1169,7 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
data->req.bytecount += chunk; data->req.bytecount += chunk;
infof(data, "Written %zu bytes, %" CURL_FORMAT_CURL_OFF_TU infof(data, "Written %zu bytes, %" CURL_FORMAT_CURL_OFF_TU
" bytes are left for transfer\n", chunk, size - chunk); " bytes are left for transfer", chunk, size - chunk);
/* Have we used the entire cache or just part of it?*/ /* Have we used the entire cache or just part of it?*/
if(pp->cache_size > chunk) { if(pp->cache_size > chunk) {
@ -1543,7 +1543,7 @@ static CURLcode imap_perform(struct Curl_easy *data, bool *connected,
struct imap_conn *imapc = &conn->proto.imapc; struct imap_conn *imapc = &conn->proto.imapc;
bool selected = FALSE; bool selected = FALSE;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
if(data->set.opt_no_body) { if(data->set.opt_no_body) {
/* Requested no body means no transfer */ /* Requested no body means no transfer */
@ -1590,7 +1590,7 @@ static CURLcode imap_perform(struct Curl_easy *data, bool *connected,
*connected = conn->bits.tcpconnect[FIRSTSOCKET]; *connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) if(*dophase_done)
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
return result; return result;
} }
@ -1682,11 +1682,11 @@ static CURLcode imap_doing(struct Curl_easy *data, bool *dophase_done)
CURLcode result = imap_multi_statemach(data, dophase_done); CURLcode result = imap_multi_statemach(data, dophase_done);
if(result) if(result)
DEBUGF(infof(data, "DO phase failed\n")); DEBUGF(infof(data, "DO phase failed"));
else if(*dophase_done) { else if(*dophase_done) {
result = imap_dophase_done(data, FALSE /* not connected */); result = imap_dophase_done(data, FALSE /* not connected */);
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
@ -2017,7 +2017,7 @@ static CURLcode imap_parse_url_path(struct Curl_easy *data)
return result; return result;
} }
DEBUGF(infof(data, "IMAP URL parameter '%s' = '%s'\n", name, value)); DEBUGF(infof(data, "IMAP URL parameter '%s' = '%s'", name, value));
/* Process the known hierarchical parameters (UIDVALIDITY, UID, SECTION and /* Process the known hierarchical parameters (UIDVALIDITY, UID, SECTION and
PARTIAL) stripping of the trailing slash character if it is present. PARTIAL) stripping of the trailing slash character if it is present.

View File

@ -263,7 +263,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
} }
/* We pass NULL as |output_name_type| to avoid a leak. */ /* We pass NULL as |output_name_type| to avoid a leak. */
gss_display_name(&min, gssname, &output_buffer, NULL); gss_display_name(&min, gssname, &output_buffer, NULL);
Curl_infof(data, "Trying against %s\n", output_buffer.value); infof(data, "Trying against %s", output_buffer.value);
gssresp = GSS_C_NO_BUFFER; gssresp = GSS_C_NO_BUFFER;
*context = GSS_C_NO_CONTEXT; *context = GSS_C_NO_CONTEXT;
@ -290,7 +290,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
} }
if(GSS_ERROR(maj)) { if(GSS_ERROR(maj)) {
Curl_infof(data, "Error creating security context\n"); infof(data, "Error creating security context");
ret = AUTH_ERROR; ret = AUTH_ERROR;
break; break;
} }
@ -301,8 +301,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
result = Curl_base64_encode(data, (char *)output_buffer.value, result = Curl_base64_encode(data, (char *)output_buffer.value,
output_buffer.length, &p, &base64_sz); output_buffer.length, &p, &base64_sz);
if(result) { if(result) {
Curl_infof(data, "base64-encoding: %s\n", infof(data, "base64-encoding: %s", curl_easy_strerror(result));
curl_easy_strerror(result));
ret = AUTH_ERROR; ret = AUTH_ERROR;
break; break;
} }
@ -327,7 +326,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
} }
if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3') { if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3') {
Curl_infof(data, "Server didn't accept auth data\n"); infof(data, "Server didn't accept auth data");
ret = AUTH_ERROR; ret = AUTH_ERROR;
break; break;
} }
@ -629,7 +628,7 @@ static void do_sec_send(struct Curl_easy *data, struct connectdata *conn,
socket_write(data, fd, cmd_buffer, cmd_size); socket_write(data, fd, cmd_buffer, cmd_size);
socket_write(data, fd, "\r\n", 2); socket_write(data, fd, "\r\n", 2);
infof(data, "Send: %s%s\n", prot_level == PROT_PRIVATE?enc:mic, infof(data, "Send: %s%s", prot_level == PROT_PRIVATE?enc:mic,
cmd_buffer); cmd_buffer);
free(cmd_buffer); free(cmd_buffer);
} }
@ -738,7 +737,7 @@ static int sec_set_protection_level(struct Curl_easy *data)
if(!conn->sec_complete) { if(!conn->sec_complete) {
infof(data, "Trying to change the protection level after the" infof(data, "Trying to change the protection level after the"
" completion of the data exchange.\n"); " completion of the data exchange.");
return -1; return -1;
} }
@ -815,13 +814,13 @@ static CURLcode choose_mech(struct Curl_easy *data, struct connectdata *conn)
if(mech->init) { if(mech->init) {
ret = mech->init(conn->app_data); ret = mech->init(conn->app_data);
if(ret) { if(ret) {
infof(data, "Failed initialization for %s. Skipping it.\n", infof(data, "Failed initialization for %s. Skipping it.",
mech->name); mech->name);
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
} }
infof(data, "Trying mechanism %s...\n", mech->name); infof(data, "Trying mechanism %s...", mech->name);
ret = ftp_send_command(data, "AUTH %s", mech->name); ret = ftp_send_command(data, "AUTH %s", mech->name);
if(ret < 0) if(ret < 0)
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
@ -830,15 +829,15 @@ static CURLcode choose_mech(struct Curl_easy *data, struct connectdata *conn)
switch(ret) { switch(ret) {
case 504: case 504:
infof(data, "Mechanism %s is not supported by the server (server " infof(data, "Mechanism %s is not supported by the server (server "
"returned ftp code: 504).\n", mech->name); "returned ftp code: 504).", mech->name);
break; break;
case 534: case 534:
infof(data, "Mechanism %s was rejected by the server (server returned " infof(data, "Mechanism %s was rejected by the server (server returned "
"ftp code: 534).\n", mech->name); "ftp code: 534).", mech->name);
break; break;
default: default:
if(ret/100 == 5) { if(ret/100 == 5) {
infof(data, "server does not support the security extensions\n"); infof(data, "server does not support the security extensions");
return CURLE_USE_SSL_FAILED; return CURLE_USE_SSL_FAILED;
} }
break; break;

View File

@ -296,9 +296,9 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
char *passwd = NULL; char *passwd = NULL;
*done = TRUE; /* unconditionally */ *done = TRUE; /* unconditionally */
infof(data, "LDAP local: LDAP Vendor = %s ; LDAP Version = %d\n", infof(data, "LDAP local: LDAP Vendor = %s ; LDAP Version = %d",
LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION); LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION);
infof(data, "LDAP local: %s\n", data->state.url); infof(data, "LDAP local: %s", data->state.url);
#ifdef HAVE_LDAP_URL_PARSE #ifdef HAVE_LDAP_URL_PARSE
rc = ldap_url_parse(data->state.url, &ludp); rc = ldap_url_parse(data->state.url, &ludp);
@ -314,7 +314,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
/* Get the URL scheme (either ldap or ldaps) */ /* Get the URL scheme (either ldap or ldaps) */
if(conn->given->flags & PROTOPT_SSL) if(conn->given->flags & PROTOPT_SSL)
ldap_ssl = 1; ldap_ssl = 1;
infof(data, "LDAP local: trying to establish %s connection\n", infof(data, "LDAP local: trying to establish %s connection",
ldap_ssl ? "encrypted" : "cleartext"); ldap_ssl ? "encrypted" : "cleartext");
#if defined(USE_WIN32_LDAP) #if defined(USE_WIN32_LDAP)
@ -366,14 +366,14 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
result = CURLE_SSL_CERTPROBLEM; result = CURLE_SSL_CERTPROBLEM;
goto quit; goto quit;
} }
infof(data, "LDAP local: using %s CA cert '%s'\n", infof(data, "LDAP local: using %s CA cert '%s'",
(cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"), (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"),
ldap_ca); ldap_ca);
rc = ldapssl_add_trusted_cert(ldap_ca, cert_type); rc = ldapssl_add_trusted_cert(ldap_ca, cert_type);
if(rc != LDAP_SUCCESS) { if(rc != LDAP_SUCCESS) {
failf(data, "LDAP local: ERROR setting %s CA cert: %s", failf(data, "LDAP local: ERROR setting %s CA cert: %s",
(cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"), (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"),
ldap_err2string(rc)); ldap_err2string(rc));
result = CURLE_SSL_CERTPROBLEM; result = CURLE_SSL_CERTPROBLEM;
goto quit; goto quit;
} }
@ -409,7 +409,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
result = CURLE_SSL_CERTPROBLEM; result = CURLE_SSL_CERTPROBLEM;
goto quit; goto quit;
} }
infof(data, "LDAP local: using PEM CA cert: %s\n", ldap_ca); infof(data, "LDAP local: using PEM CA cert: %s", ldap_ca);
rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca); rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca);
if(rc != LDAP_SUCCESS) { if(rc != LDAP_SUCCESS) {
failf(data, "LDAP local: ERROR setting PEM CA cert: %s", failf(data, "LDAP local: ERROR setting PEM CA cert: %s",
@ -718,7 +718,7 @@ quit:
LDAP_TRACE(("Received %d entries\n", num)); LDAP_TRACE(("Received %d entries\n", num));
} }
if(rc == LDAP_SIZELIMIT_EXCEEDED) if(rc == LDAP_SIZELIMIT_EXCEEDED)
infof(data, "There are more than %d entries\n", num); infof(data, "There are more than %d entries", num);
if(ludp) if(ludp)
ldap_free_urldesc(ludp); ldap_free_urldesc(ludp);
if(server) if(server)

View File

@ -297,7 +297,7 @@ static CURLcode mqtt_connect(struct Curl_easy *data)
result = CURLE_WEIRD_SERVER_REPLY; result = CURLE_WEIRD_SERVER_REPLY;
goto end; goto end;
} }
infof(data, "Using client id '%s'\n", client_id); infof(data, "Using client id '%s'", client_id);
/* position where starts the user payload */ /* position where starts the user payload */
start_user = pos + 3 + MQTT_CLIENTID_LEN; start_user = pos + 3 + MQTT_CLIENTID_LEN;
@ -560,7 +560,7 @@ static void mqstate(struct Curl_easy *data,
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
struct mqtt_conn *mqtt = &conn->proto.mqtt; struct mqtt_conn *mqtt = &conn->proto.mqtt;
#ifdef CURLDEBUG #ifdef CURLDEBUG
infof(data, "%s (from %s) (next is %s)\n", infof(data, "%s (from %s) (next is %s)",
statenames[state], statenames[state],
statenames[mqtt->state], statenames[mqtt->state],
(state == MQTT_FIRST)? statenames[nextstate] : ""); (state == MQTT_FIRST)? statenames[nextstate] : "");
@ -607,7 +607,7 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
goto MQTT_SUBACK_COMING; goto MQTT_SUBACK_COMING;
} }
else if(packet == MQTT_MSG_DISCONNECT) { else if(packet == MQTT_MSG_DISCONNECT) {
infof(data, "Got DISCONNECT\n"); infof(data, "Got DISCONNECT");
*done = TRUE; *done = TRUE;
goto end; goto end;
} }
@ -618,7 +618,7 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
/* -- switched state -- */ /* -- switched state -- */
remlen = mq->remaining_length; remlen = mq->remaining_length;
infof(data, "Remaining length: %zd bytes\n", remlen); infof(data, "Remaining length: %zd bytes", remlen);
if(data->set.max_filesize && if(data->set.max_filesize &&
(curl_off_t)remlen > data->set.max_filesize) { (curl_off_t)remlen > data->set.max_filesize) {
failf(data, "Maximum file size exceeded"); failf(data, "Maximum file size exceeded");
@ -639,12 +639,12 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
result = Curl_read(data, sockfd, (char *)pkt, rest, &nread); result = Curl_read(data, sockfd, (char *)pkt, rest, &nread);
if(result) { if(result) {
if(CURLE_AGAIN == result) { if(CURLE_AGAIN == result) {
infof(data, "EEEE AAAAGAIN\n"); infof(data, "EEEE AAAAGAIN");
} }
goto end; goto end;
} }
if(!nread) { if(!nread) {
infof(data, "server disconnected\n"); infof(data, "server disconnected");
result = CURLE_PARTIAL_FILE; result = CURLE_PARTIAL_FILE;
goto end; goto end;
} }
@ -710,7 +710,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
return result; return result;
} }
infof(data, "mqtt_doing: state [%d]\n", (int) mqtt->state); infof(data, "mqtt_doing: state [%d]", (int) mqtt->state);
switch(mqtt->state) { switch(mqtt->state) {
case MQTT_FIRST: case MQTT_FIRST:
/* Read the initial byte only */ /* Read the initial byte only */
@ -745,7 +745,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
mqstate(data, MQTT_FIRST, MQTT_FIRST); mqstate(data, MQTT_FIRST, MQTT_FIRST);
if(mq->firstbyte == MQTT_MSG_DISCONNECT) { if(mq->firstbyte == MQTT_MSG_DISCONNECT) {
infof(data, "Got DISCONNECT\n"); infof(data, "Got DISCONNECT");
*done = TRUE; *done = TRUE;
} }
break; break;

View File

@ -169,7 +169,7 @@ static void mstate(struct Curl_easy *data, CURLMstate state
connection_id = data->conn->connection_id; connection_id = data->conn->connection_id;
infof(data, infof(data,
"STATE: %s => %s handle %p; line %d (connection #%ld)\n", "STATE: %s => %s handle %p; line %d (connection #%ld)",
statename[oldstate], statename[data->mstate], statename[oldstate], statename[data->mstate],
(void *)data, lineno, connection_id); (void *)data, lineno, connection_id);
} }
@ -562,7 +562,7 @@ static CURLcode multi_done(struct Curl_easy *data,
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
unsigned int i; unsigned int i;
DEBUGF(infof(data, "multi_done\n")); DEBUGF(infof(data, "multi_done"));
if(data->state.done) if(data->state.done)
/* Stop if multi_done() has already been called */ /* Stop if multi_done() has already been called */
@ -610,7 +610,7 @@ static CURLcode multi_done(struct Curl_easy *data,
/* Stop if still used. */ /* Stop if still used. */
CONNCACHE_UNLOCK(data); CONNCACHE_UNLOCK(data);
DEBUGF(infof(data, "Connection still in use %zu, " DEBUGF(infof(data, "Connection still in use %zu, "
"no more multi_done now!\n", "no more multi_done now!",
conn->easyq.size)); conn->easyq.size));
return CURLE_OK; return CURLE_OK;
} }
@ -687,7 +687,7 @@ static CURLcode multi_done(struct Curl_easy *data,
if(Curl_conncache_return_conn(data, conn)) { if(Curl_conncache_return_conn(data, conn)) {
/* remember the most recently used connection */ /* remember the most recently used connection */
data->state.lastconnect_id = conn->connection_id; data->state.lastconnect_id = conn->connection_id;
infof(data, "%s\n", buffer); infof(data, "%s", buffer);
} }
else else
data->state.lastconnect_id = -1; data->state.lastconnect_id = -1;
@ -1740,7 +1740,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
rc = CURLM_OK; rc = CURLM_OK;
if(multi_ischanged(multi, TRUE)) { if(multi_ischanged(multi, TRUE)) {
DEBUGF(infof(data, "multi changed, check CONNECT_PEND queue!\n")); DEBUGF(infof(data, "multi changed, check CONNECT_PEND queue!"));
process_pending_handles(multi); /* multiplexed */ process_pending_handles(multi); /* multiplexed */
} }
@ -1816,7 +1816,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
} }
else if(data->state.previouslypending) { else if(data->state.previouslypending) {
/* this transfer comes from the pending queue so try move another */ /* this transfer comes from the pending queue so try move another */
infof(data, "Transfer was pending, now try another\n"); infof(data, "Transfer was pending, now try another");
process_pending_handles(data->multi); process_pending_handles(data->multi);
} }
@ -1871,7 +1871,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
data->state.async.done = TRUE; data->state.async.done = TRUE;
#endif #endif
result = CURLE_OK; result = CURLE_OK;
infof(data, "Hostname '%s' was found in DNS cache\n", hostname); infof(data, "Hostname '%s' was found in DNS cache", hostname);
} }
if(!dns) if(!dns)
@ -2303,7 +2303,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
CURLcode ret = Curl_retry_request(data, &newurl); CURLcode ret = Curl_retry_request(data, &newurl);
if(!ret) { if(!ret) {
infof(data, "Downgrades to HTTP/1.1!\n"); infof(data, "Downgrades to HTTP/1.1!");
streamclose(data->conn, "Disconnect HTTP/2 for HTTP/1"); streamclose(data->conn, "Disconnect HTTP/2 for HTTP/1");
data->state.httpwant = CURL_HTTP_VERSION_1_1; data->state.httpwant = CURL_HTTP_VERSION_1_1;
/* clear the error message bit too as we ignore the one we got */ /* clear the error message bit too as we ignore the one we got */
@ -3378,7 +3378,7 @@ void Curl_expire(struct Curl_easy *data, timediff_t milli, expire_id id)
rc = Curl_splayremove(multi->timetree, &data->state.timenode, rc = Curl_splayremove(multi->timetree, &data->state.timenode,
&multi->timetree); &multi->timetree);
if(rc) if(rc)
infof(data, "Internal error removing splay node = %d\n", rc); infof(data, "Internal error removing splay node = %d", rc);
} }
/* Indicate that we are in the splay tree and insert the new timer expiry /* Indicate that we are in the splay tree and insert the new timer expiry
@ -3425,7 +3425,7 @@ void Curl_expire_clear(struct Curl_easy *data)
rc = Curl_splayremove(multi->timetree, &data->state.timenode, rc = Curl_splayremove(multi->timetree, &data->state.timenode,
&multi->timetree); &multi->timetree);
if(rc) if(rc)
infof(data, "Internal error clearing splay node = %d\n", rc); infof(data, "Internal error clearing splay node = %d", rc);
/* flush the timeout list too */ /* flush the timeout list too */
while(list->size > 0) { while(list->size > 0) {
@ -3433,7 +3433,7 @@ void Curl_expire_clear(struct Curl_easy *data)
} }
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
infof(data, "Expire cleared (transfer %p)\n", data); infof(data, "Expire cleared (transfer %p)", data);
#endif #endif
nowp->tv_sec = 0; nowp->tv_sec = 0;
nowp->tv_usec = 0; nowp->tv_usec = 0;

View File

@ -400,7 +400,7 @@ static CURLcode oldap_do(struct Curl_easy *data, bool *done)
connkeep(conn, "OpenLDAP do"); connkeep(conn, "OpenLDAP do");
infof(data, "LDAP local: %s\n", data->state.url); infof(data, "LDAP local: %s", data->state.url);
rc = ldap_url_parse(data->state.url, &ludp); rc = ldap_url_parse(data->state.url, &ludp);
if(rc != LDAP_URL_SUCCESS) { if(rc != LDAP_URL_SUCCESS) {
@ -510,7 +510,7 @@ static ssize_t oldap_recv(struct Curl_easy *data, int sockindex, char *buf,
else { else {
/* successful */ /* successful */
if(code == LDAP_SIZELIMIT_EXCEEDED) if(code == LDAP_SIZELIMIT_EXCEEDED)
infof(data, "There are more than %d entries\n", lr->nument); infof(data, "There are more than %d entries", lr->nument);
data->req.size = data->req.bytecount; data->req.size = data->req.bytecount;
*err = CURLE_OK; *err = CURLE_OK;
ret = 0; ret = 0;

View File

@ -402,7 +402,7 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
clipamount = gotbytes - i; clipamount = gotbytes - i;
restart = TRUE; restart = TRUE;
DEBUGF(infof(data, "Curl_pp_readresp_ %d bytes of trailing " DEBUGF(infof(data, "Curl_pp_readresp_ %d bytes of trailing "
"server response left\n", "server response left",
(int)clipamount)); (int)clipamount));
} }
else if(keepon) { else if(keepon) {
@ -412,7 +412,7 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
with it. We keep the first bytes of the line then we throw with it. We keep the first bytes of the line then we throw
away the rest. */ away the rest. */
infof(data, "Excessive server response line length received, " infof(data, "Excessive server response line length received, "
"%zd bytes. Stripping\n", gotbytes); "%zd bytes. Stripping", gotbytes);
restart = TRUE; restart = TRUE;
/* we keep 40 bytes since all our pingpong protocols are only /* we keep 40 bytes since all our pingpong protocols are only

View File

@ -308,7 +308,7 @@ static void state(struct Curl_easy *data, pop3state newstate)
}; };
if(pop3c->state != newstate) if(pop3c->state != newstate)
infof(data, "POP3 %p state change from %s to %s\n", infof(data, "POP3 %p state change from %s to %s",
(void *)pop3c, names[pop3c->state], names[newstate]); (void *)pop3c, names[pop3c->state], names[newstate]);
#endif #endif
@ -552,7 +552,7 @@ static CURLcode pop3_perform_authentication(struct Curl_easy *data,
result = pop3_perform_user(data, conn); result = pop3_perform_user(data, conn);
else { else {
/* Other mechanisms not supported */ /* Other mechanisms not supported */
infof(data, "No known authentication mechanisms supported!\n"); infof(data, "No known authentication mechanisms supported!");
result = CURLE_LOGIN_DENIED; result = CURLE_LOGIN_DENIED;
} }
} }
@ -1173,7 +1173,7 @@ static CURLcode pop3_perform(struct Curl_easy *data, bool *connected,
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
struct POP3 *pop3 = data->req.p.pop3; struct POP3 *pop3 = data->req.p.pop3;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
if(data->set.opt_no_body) { if(data->set.opt_no_body) {
/* Requested no body means no transfer */ /* Requested no body means no transfer */
@ -1192,7 +1192,7 @@ static CURLcode pop3_perform(struct Curl_easy *data, bool *connected,
*connected = conn->bits.tcpconnect[FIRSTSOCKET]; *connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) if(*dophase_done)
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
return result; return result;
} }
@ -1275,11 +1275,11 @@ static CURLcode pop3_doing(struct Curl_easy *data, bool *dophase_done)
CURLcode result = pop3_multi_statemach(data, dophase_done); CURLcode result = pop3_multi_statemach(data, dophase_done);
if(result) if(result)
DEBUGF(infof(data, "DO phase failed\n")); DEBUGF(infof(data, "DO phase failed"));
else if(*dophase_done) { else if(*dophase_done) {
result = pop3_dophase_done(data, FALSE /* not connected */); result = pop3_dophase_done(data, FALSE /* not connected */);
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -87,7 +87,7 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd)
if(!seeded) { if(!seeded) {
struct curltime now = Curl_now(); struct curltime now = Curl_now();
infof(data, "WARNING: Using weak random seed\n"); infof(data, "WARNING: Using weak random seed");
randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec; randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec;
randseed = randseed * 1103515245 + 12345; randseed = randseed * 1103515245 + 12345;
randseed = randseed * 1103515245 + 12345; randseed = randseed * 1103515245 + 12345;

View File

@ -231,7 +231,7 @@ static CURLcode rtsp_done(struct Curl_easy *data,
} }
if(data->set.rtspreq == RTSPREQ_RECEIVE && if(data->set.rtspreq == RTSPREQ_RECEIVE &&
(data->conn->proto.rtspc.rtp_channel == -1)) { (data->conn->proto.rtspc.rtp_channel == -1)) {
infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv); infof(data, "Got an RTP Receive with a CSeq of %ld", CSeq_recv);
} }
} }
@ -651,7 +651,7 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
} }
/* We have the full RTP interleaved packet /* We have the full RTP interleaved packet
* Write out the header including the leading '$' */ * Write out the header including the leading '$' */
DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n", DEBUGF(infof(data, "RTP write channel %d rtp_length %d",
rtspc->rtp_channel, rtp_length)); rtspc->rtp_channel, rtp_length));
result = rtp_client_write(data, &rtp[0], rtp_length + 4); result = rtp_client_write(data, &rtp[0], rtp_length + 4);
if(result) { if(result) {
@ -682,7 +682,7 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
} }
if(rtp_dataleft && rtp[0] == '$') { if(rtp_dataleft && rtp[0] == '$') {
DEBUGF(infof(data, "RTP Rewinding %zd %s\n", rtp_dataleft, DEBUGF(infof(data, "RTP Rewinding %zd %s", rtp_dataleft,
*readmore ? "(READMORE)" : "")); *readmore ? "(READMORE)" : ""));
/* Store the incomplete RTP packet for a "rewind" */ /* Store the incomplete RTP packet for a "rewind" */

View File

@ -236,29 +236,22 @@ bool Curl_recv_has_postponed_data(struct connectdata *conn, int sockindex)
#endif /* ! USE_RECV_BEFORE_SEND_WORKAROUND */ #endif /* ! USE_RECV_BEFORE_SEND_WORKAROUND */
/* Curl_infof() is for info message along the way */ /* Curl_infof() is for info message along the way */
#define MAXINFO 2048
void Curl_infof(struct Curl_easy *data, const char *fmt, ...) void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
{ {
DEBUGASSERT(!strchr(fmt, '\n'));
if(data && data->set.verbose) { if(data && data->set.verbose) {
va_list ap; va_list ap;
size_t len; size_t len;
char print_buffer[2048 + 1]; char buffer[MAXINFO + 2];
va_start(ap, fmt); va_start(ap, fmt);
len = mvsnprintf(print_buffer, sizeof(print_buffer), fmt, ap); (void)mvsnprintf(buffer, MAXINFO, fmt, ap);
/* len = strlen(buffer);
* Indicate truncation of the input by replacing the last 3 characters
* with "...", and transfer the newline over in case the format had one.
*/
if(len >= sizeof(print_buffer)) {
len = strlen(fmt);
if(fmt[--len] == '\n')
msnprintf(print_buffer + (sizeof(print_buffer) - 5), 5, "...\n");
else
msnprintf(print_buffer + (sizeof(print_buffer) - 4), 4, "...");
}
va_end(ap); va_end(ap);
len = strlen(print_buffer); buffer[len++] = '\n';
Curl_debug(data, CURLINFO_TEXT, print_buffer, len); buffer[len] = '\0';
Curl_debug(data, CURLINFO_TEXT, buffer, len);
} }
} }
@ -282,6 +275,7 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
data->state.errorbuf = TRUE; /* wrote error string */ data->state.errorbuf = TRUE; /* wrote error string */
} }
error[len++] = '\n'; error[len++] = '\n';
error[len] = '\0';
Curl_debug(data, CURLINFO_TEXT, error, len); Curl_debug(data, CURLINFO_TEXT, error, len);
va_end(ap); va_end(ap);
} }

View File

@ -204,7 +204,7 @@ static void conn_state(struct Curl_easy *data, enum smb_conn_state newstate)
}; };
if(smbc->state != newstate) if(smbc->state != newstate)
infof(data, "SMB conn %p state change from %s to %s\n", infof(data, "SMB conn %p state change from %s to %s",
(void *)smbc, names[smbc->state], names[newstate]); (void *)smbc, names[smbc->state], names[newstate]);
#endif #endif
@ -230,7 +230,7 @@ static void request_state(struct Curl_easy *data,
}; };
if(req->state != newstate) if(req->state != newstate)
infof(data, "SMB request %p state change from %s to %s\n", infof(data, "SMB request %p state change from %s to %s",
(void *)req, names[req->state], names[newstate]); (void *)req, names[req->state], names[newstate]);
#endif #endif

View File

@ -308,7 +308,7 @@ static void state(struct Curl_easy *data, smtpstate newstate)
}; };
if(smtpc->state != newstate) if(smtpc->state != newstate)
infof(data, "SMTP %p state change from %s to %s\n", infof(data, "SMTP %p state change from %s to %s",
(void *)smtpc, names[smtpc->state], names[newstate]); (void *)smtpc, names[smtpc->state], names[newstate]);
#endif #endif
@ -485,7 +485,7 @@ static CURLcode smtp_perform_authentication(struct Curl_easy *data)
state(data, SMTP_AUTH); state(data, SMTP_AUTH);
else { else {
/* Other mechanisms not supported */ /* Other mechanisms not supported */
infof(data, "No known authentication mechanisms supported!\n"); infof(data, "No known authentication mechanisms supported!");
result = CURLE_LOGIN_DENIED; result = CURLE_LOGIN_DENIED;
} }
} }
@ -1456,7 +1456,7 @@ static CURLcode smtp_perform(struct Curl_easy *data, bool *connected,
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
struct SMTP *smtp = data->req.p.smtp; struct SMTP *smtp = data->req.p.smtp;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
if(data->set.opt_no_body) { if(data->set.opt_no_body) {
/* Requested no body means no transfer */ /* Requested no body means no transfer */
@ -1496,7 +1496,7 @@ static CURLcode smtp_perform(struct Curl_easy *data, bool *connected,
*connected = conn->bits.tcpconnect[FIRSTSOCKET]; *connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) if(*dophase_done)
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
return result; return result;
} }
@ -1580,11 +1580,11 @@ static CURLcode smtp_doing(struct Curl_easy *data, bool *dophase_done)
CURLcode result = smtp_multi_statemach(data, dophase_done); CURLcode result = smtp_multi_statemach(data, dophase_done);
if(result) if(result)
DEBUGF(infof(data, "DO phase failed\n")); DEBUGF(infof(data, "DO phase failed"));
else if(*dophase_done) { else if(*dophase_done) {
result = smtp_dophase_done(data, FALSE /* not connected */); result = smtp_dophase_done(data, FALSE /* not connected */);
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;

View File

@ -148,7 +148,7 @@ static void socksstate(struct Curl_easy *data,
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
infof(data, infof(data,
"SXSTATE: %s => %s conn %p; line %d\n", "SXSTATE: %s => %s conn %p; line %d",
statename[oldstate], statename[conn->cnnct.state], conn, statename[oldstate], statename[conn->cnnct.state], conn,
lineno); lineno);
#endif #endif
@ -214,10 +214,10 @@ CURLproxycode Curl_SOCKS4(const char *proxy_user,
/* SOCKS4 can only do IPv4, insist! */ /* SOCKS4 can only do IPv4, insist! */
conn->ip_version = CURL_IPRESOLVE_V4; conn->ip_version = CURL_IPRESOLVE_V4;
if(conn->bits.httpproxy) if(conn->bits.httpproxy)
infof(data, "SOCKS4%s: connecting to HTTP proxy %s port %d\n", infof(data, "SOCKS4%s: connecting to HTTP proxy %s port %d",
protocol4a ? "a" : "", hostname, remote_port); protocol4a ? "a" : "", hostname, remote_port);
infof(data, "SOCKS4 communication to %s:%d\n", hostname, remote_port); infof(data, "SOCKS4 communication to %s:%d", hostname, remote_port);
/* /*
* Compose socks4 request * Compose socks4 request
@ -244,7 +244,7 @@ CURLproxycode Curl_SOCKS4(const char *proxy_user,
return CURLPX_RESOLVE_HOST; return CURLPX_RESOLVE_HOST;
else if(rc == CURLRESOLV_PENDING) { else if(rc == CURLRESOLV_PENDING) {
sxstate(data, CONNECT_RESOLVING); sxstate(data, CONNECT_RESOLVING);
infof(data, "SOCKS4 non-blocking resolve of %s\n", hostname); infof(data, "SOCKS4 non-blocking resolve of %s", hostname);
return CURLPX_OK; return CURLPX_OK;
} }
sxstate(data, CONNECT_RESOLVED); sxstate(data, CONNECT_RESOLVED);
@ -264,7 +264,7 @@ CURLproxycode Curl_SOCKS4(const char *proxy_user,
data->state.async.dns = dns; data->state.async.dns = dns;
data->state.async.done = TRUE; data->state.async.done = TRUE;
#endif #endif
infof(data, "Hostname '%s' was found\n", hostname); infof(data, "Hostname '%s' was found", hostname);
sxstate(data, CONNECT_RESOLVED); sxstate(data, CONNECT_RESOLVED);
} }
else { else {
@ -301,7 +301,7 @@ CURLproxycode Curl_SOCKS4(const char *proxy_user,
socksreq[6] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[2]; socksreq[6] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[2];
socksreq[7] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[3]; socksreq[7] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[3];
infof(data, "SOCKS4 connect to IPv4 %s (locally resolved)\n", buf); infof(data, "SOCKS4 connect to IPv4 %s (locally resolved)", buf);
Curl_resolv_unlock(data, dns); /* not used anymore from now on */ Curl_resolv_unlock(data, dns); /* not used anymore from now on */
} }
@ -437,7 +437,7 @@ CURLproxycode Curl_SOCKS4(const char *proxy_user,
/* Result */ /* Result */
switch(socksreq[1]) { switch(socksreq[1]) {
case 90: case 90:
infof(data, "SOCKS4%s request granted.\n", protocol4a?"a":""); infof(data, "SOCKS4%s request granted.", protocol4a?"a":"");
break; break;
case 91: case 91:
failf(data, failf(data,
@ -530,19 +530,19 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
switch(sx->state) { switch(sx->state) {
case CONNECT_SOCKS_INIT: case CONNECT_SOCKS_INIT:
if(conn->bits.httpproxy) if(conn->bits.httpproxy)
infof(data, "SOCKS5: connecting to HTTP proxy %s port %d\n", infof(data, "SOCKS5: connecting to HTTP proxy %s port %d",
hostname, remote_port); hostname, remote_port);
/* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */ /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
if(!socks5_resolve_local && hostname_len > 255) { if(!socks5_resolve_local && hostname_len > 255) {
infof(data, "SOCKS5: server resolving disabled for hostnames of " infof(data, "SOCKS5: server resolving disabled for hostnames of "
"length > 255 [actual len=%zu]\n", hostname_len); "length > 255 [actual len=%zu]", hostname_len);
socks5_resolve_local = TRUE; socks5_resolve_local = TRUE;
} }
if(auth & ~(CURLAUTH_BASIC | CURLAUTH_GSSAPI)) if(auth & ~(CURLAUTH_BASIC | CURLAUTH_GSSAPI))
infof(data, infof(data,
"warning: unsupported value passed to CURLOPT_SOCKS5_AUTH: %lu\n", "warning: unsupported value passed to CURLOPT_SOCKS5_AUTH: %lu",
auth); auth);
if(!(auth & CURLAUTH_BASIC)) if(!(auth & CURLAUTH_BASIC))
/* disable username/password auth */ /* disable username/password auth */
@ -780,7 +780,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
data->state.async.dns = dns; data->state.async.dns = dns;
data->state.async.done = TRUE; data->state.async.done = TRUE;
#endif #endif
infof(data, "SOCKS5: hostname '%s' found\n", hostname); infof(data, "SOCKS5: hostname '%s' found", hostname);
} }
if(!dns) { if(!dns) {
@ -822,7 +822,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
socksreq[len++] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[i]; socksreq[len++] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[i];
} }
infof(data, "SOCKS5 connect to IPv4 %s (locally resolved)\n", dest); infof(data, "SOCKS5 connect to IPv4 %s (locally resolved)", dest);
} }
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
else if(hp->ai_family == AF_INET6) { else if(hp->ai_family == AF_INET6) {
@ -836,7 +836,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
((unsigned char *)&saddr_in6->sin6_addr.s6_addr)[i]; ((unsigned char *)&saddr_in6->sin6_addr.s6_addr)[i];
} }
infof(data, "SOCKS5 connect to IPv6 %s (locally resolved)\n", dest); infof(data, "SOCKS5 connect to IPv6 %s (locally resolved)", dest);
} }
#endif #endif
else { else {
@ -860,7 +860,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
socksreq[len++] = (char) hostname_len; /* one byte address length */ socksreq[len++] = (char) hostname_len; /* one byte address length */
memcpy(&socksreq[len], hostname, hostname_len); /* address w/o NULL */ memcpy(&socksreq[len], hostname, hostname_len); /* address w/o NULL */
len += hostname_len; len += hostname_len;
infof(data, "SOCKS5 connect to %s:%d (remotely resolved)\n", infof(data, "SOCKS5 connect to %s:%d (remotely resolved)",
hostname, remote_port); hostname, remote_port);
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
@ -1024,7 +1024,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
} }
sxstate(data, CONNECT_DONE); sxstate(data, CONNECT_DONE);
} }
infof(data, "SOCKS5 request granted.\n"); infof(data, "SOCKS5 request granted.");
*done = TRUE; *done = TRUE;
return CURLPX_OK; /* Proxy was successful! */ return CURLPX_OK; /* Proxy was successful! */

View File

@ -328,7 +328,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
user[gss_send_token.length] = '\0'; user[gss_send_token.length] = '\0';
gss_release_name(&gss_status, &gss_client_name); gss_release_name(&gss_status, &gss_client_name);
gss_release_buffer(&gss_status, &gss_send_token); gss_release_buffer(&gss_status, &gss_send_token);
infof(data, "SOCKS5 server authenticated user %s with GSS-API.\n",user); infof(data, "SOCKS5 server authenticated user %s with GSS-API.",user);
free(user); free(user);
user = NULL; user = NULL;
@ -344,7 +344,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
else if(gss_ret_flags & GSS_C_INTEG_FLAG) else if(gss_ret_flags & GSS_C_INTEG_FLAG)
gss_enc = 1; gss_enc = 1;
infof(data, "SOCKS5 server supports GSS-API %s data protection.\n", infof(data, "SOCKS5 server supports GSS-API %s data protection.",
(gss_enc == 0)?"no":((gss_enc==1)?"integrity":"confidentiality")); (gss_enc == 0)?"no":((gss_enc==1)?"integrity":"confidentiality"));
/* force for the moment to no data protection */ /* force for the moment to no data protection */
gss_enc = 0; gss_enc = 0;
@ -518,7 +518,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
(void)curlx_nonblock(sock, TRUE); (void)curlx_nonblock(sock, TRUE);
infof(data, "SOCKS5 access with%s protection granted.\n", infof(data, "SOCKS5 access with%s protection granted.",
(socksreq[0] == 0)?"out GSS-API data": (socksreq[0] == 0)?"out GSS-API data":
((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality")); ((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality"));

View File

@ -327,7 +327,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
failf(data, "Failed to determine user name."); failf(data, "Failed to determine user name.");
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
infof(data, "SOCKS5 server authenticated user %s with GSS-API.\n", infof(data, "SOCKS5 server authenticated user %s with GSS-API.",
names.sUserName); names.sUserName);
s_pSecFn->FreeContextBuffer(names.sUserName); s_pSecFn->FreeContextBuffer(names.sUserName);
@ -343,7 +343,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
else if(sspi_ret_flags & ISC_REQ_INTEGRITY) else if(sspi_ret_flags & ISC_REQ_INTEGRITY)
gss_enc = 1; gss_enc = 1;
infof(data, "SOCKS5 server supports GSS-API %s data protection.\n", infof(data, "SOCKS5 server supports GSS-API %s data protection.",
(gss_enc == 0)?"no":((gss_enc == 1)?"integrity":"confidentiality") ); (gss_enc == 0)?"no":((gss_enc == 1)?"integrity":"confidentiality") );
/* force to no data protection, avoid encryption/decryption for now */ /* force to no data protection, avoid encryption/decryption for now */
gss_enc = 0; gss_enc = 0;
@ -591,7 +591,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
} }
(void)curlx_nonblock(sock, TRUE); (void)curlx_nonblock(sock, TRUE);
infof(data, "SOCKS5 access with%s protection granted.\n", infof(data, "SOCKS5 access with%s protection granted.",
(socksreq[0] == 0)?"out GSS-API data": (socksreq[0] == 0)?"out GSS-API data":
((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality")); ((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality"));

View File

@ -268,9 +268,9 @@ static void printoption(struct Curl_easy *data,
if(data->set.verbose) { if(data->set.verbose) {
if(cmd == CURL_IAC) { if(cmd == CURL_IAC) {
if(CURL_TELCMD_OK(option)) if(CURL_TELCMD_OK(option))
infof(data, "%s IAC %s\n", direction, CURL_TELCMD(option)); infof(data, "%s IAC %s", direction, CURL_TELCMD(option));
else else
infof(data, "%s IAC %d\n", direction, option); infof(data, "%s IAC %d", direction, option);
} }
else { else {
const char *fmt = (cmd == CURL_WILL) ? "WILL" : const char *fmt = (cmd == CURL_WILL) ? "WILL" :
@ -287,12 +287,12 @@ static void printoption(struct Curl_easy *data,
opt = NULL; opt = NULL;
if(opt) if(opt)
infof(data, "%s %s %s\n", direction, fmt, opt); infof(data, "%s %s %s", direction, fmt, opt);
else else
infof(data, "%s %s %d\n", direction, fmt, option); infof(data, "%s %s %d", direction, fmt, option);
} }
else else
infof(data, "%s %d %d\n", direction, cmd, option); infof(data, "%s %d %d", direction, cmd, option);
} }
} }
} }
@ -765,8 +765,6 @@ static void printsub(struct Curl_easy *data,
break; break;
} }
} }
if(direction)
infof(data, "\n");
} }
} }

View File

@ -239,7 +239,7 @@ static CURLcode tftp_set_timeouts(struct tftp_state_data *state)
infof(state->data, infof(state->data,
"set timeouts for state %d; Total % " CURL_FORMAT_CURL_OFF_T "set timeouts for state %d; Total % " CURL_FORMAT_CURL_OFF_T
", retry %d maxtry %d\n", ", retry %d maxtry %d",
(int)state->state, timeout_ms, state->retry_time, state->retry_max); (int)state->state, timeout_ms, state->retry_time, state->retry_max);
/* init RX time */ /* init RX time */
@ -325,7 +325,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
return CURLE_TFTP_ILLEGAL; return CURLE_TFTP_ILLEGAL;
} }
infof(data, "got option=(%s) value=(%s)\n", option, value); infof(data, "got option=(%s) value=(%s)", option, value);
if(checkprefix(option, TFTP_OPTION_BLKSIZE)) { if(checkprefix(option, TFTP_OPTION_BLKSIZE)) {
long blksize; long blksize;
@ -356,14 +356,14 @@ static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
} }
state->blksize = (int)blksize; state->blksize = (int)blksize;
infof(data, "%s (%d) %s (%d)\n", "blksize parsed from OACK", infof(data, "%s (%d) %s (%d)", "blksize parsed from OACK",
state->blksize, "requested", state->requested_blksize); state->blksize, "requested", state->requested_blksize);
} }
else if(checkprefix(option, TFTP_OPTION_TSIZE)) { else if(checkprefix(option, TFTP_OPTION_TSIZE)) {
long tsize = 0; long tsize = 0;
tsize = strtol(value, NULL, 10); tsize = strtol(value, NULL, 10);
infof(data, "%s (%ld)\n", "tsize parsed from OACK", tsize); infof(data, "%s (%ld)", "tsize parsed from OACK", tsize);
/* tsize should be ignored on upload: Who cares about the size of the /* tsize should be ignored on upload: Who cares about the size of the
remote file? */ remote file? */
@ -397,7 +397,7 @@ static CURLcode tftp_connect_for_tx(struct tftp_state_data *state,
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
struct Curl_easy *data = state->data; struct Curl_easy *data = state->data;
infof(data, "%s\n", "Connected for transmit"); infof(data, "%s", "Connected for transmit");
#endif #endif
state->state = TFTP_STATE_TX; state->state = TFTP_STATE_TX;
result = tftp_set_timeouts(state); result = tftp_set_timeouts(state);
@ -413,7 +413,7 @@ static CURLcode tftp_connect_for_rx(struct tftp_state_data *state,
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
struct Curl_easy *data = state->data; struct Curl_easy *data = state->data;
infof(data, "%s\n", "Connected for receive"); infof(data, "%s", "Connected for receive");
#endif #endif
state->state = TFTP_STATE_RX; state->state = TFTP_STATE_RX;
result = tftp_set_timeouts(state); result = tftp_set_timeouts(state);
@ -596,12 +596,12 @@ static CURLcode tftp_rx(struct tftp_state_data *state,
else if(state->block == rblock) { else if(state->block == rblock) {
/* This is the last recently received block again. Log it and ACK it /* This is the last recently received block again. Log it and ACK it
again. */ again. */
infof(data, "Received last DATA packet block %d again.\n", rblock); infof(data, "Received last DATA packet block %d again.", rblock);
} }
else { else {
/* totally unexpected, just log it */ /* totally unexpected, just log it */
infof(data, infof(data,
"Received unexpected DATA packet block %d, expecting block %d\n", "Received unexpected DATA packet block %d, expecting block %d",
rblock, NEXT_BLOCKNUM(state->block)); rblock, NEXT_BLOCKNUM(state->block));
break; break;
} }
@ -653,7 +653,7 @@ static CURLcode tftp_rx(struct tftp_state_data *state,
/* Increment the retry count and fail if over the limit */ /* Increment the retry count and fail if over the limit */
state->retries++; state->retries++;
infof(data, infof(data,
"Timeout waiting for block %d ACK. Retries = %d\n", "Timeout waiting for block %d ACK. Retries = %d",
NEXT_BLOCKNUM(state->block), state->retries); NEXT_BLOCKNUM(state->block), state->retries);
if(state->retries > state->retry_max) { if(state->retries > state->retry_max) {
state->error = TFTP_ERR_TIMEOUT; state->error = TFTP_ERR_TIMEOUT;
@ -724,7 +724,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
* */ * */
!(state->block == 0 && rblock == 65535)) { !(state->block == 0 && rblock == 65535)) {
/* This isn't the expected block. Log it and up the retry counter */ /* This isn't the expected block. Log it and up the retry counter */
infof(data, "Received ACK for block %d, expecting %d\n", infof(data, "Received ACK for block %d, expecting %d",
rblock, state->block); rblock, state->block);
state->retries++; state->retries++;
/* Bail out if over the maximum */ /* Bail out if over the maximum */
@ -797,7 +797,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
/* Increment the retry counter and log the timeout */ /* Increment the retry counter and log the timeout */
state->retries++; state->retries++;
infof(data, "Timeout waiting for block %d ACK. " infof(data, "Timeout waiting for block %d ACK. "
" Retries = %d\n", NEXT_BLOCKNUM(state->block), state->retries); " Retries = %d", NEXT_BLOCKNUM(state->block), state->retries);
/* Decide if we've had enough */ /* Decide if we've had enough */
if(state->retries > state->retry_max) { if(state->retries > state->retry_max) {
state->error = TFTP_ERR_TIMEOUT; state->error = TFTP_ERR_TIMEOUT;
@ -906,22 +906,22 @@ static CURLcode tftp_state_machine(struct tftp_state_data *state,
switch(state->state) { switch(state->state) {
case TFTP_STATE_START: case TFTP_STATE_START:
DEBUGF(infof(data, "TFTP_STATE_START\n")); DEBUGF(infof(data, "TFTP_STATE_START"));
result = tftp_send_first(state, event); result = tftp_send_first(state, event);
break; break;
case TFTP_STATE_RX: case TFTP_STATE_RX:
DEBUGF(infof(data, "TFTP_STATE_RX\n")); DEBUGF(infof(data, "TFTP_STATE_RX"));
result = tftp_rx(state, event); result = tftp_rx(state, event);
break; break;
case TFTP_STATE_TX: case TFTP_STATE_TX:
DEBUGF(infof(data, "TFTP_STATE_TX\n")); DEBUGF(infof(data, "TFTP_STATE_TX"));
result = tftp_tx(state, event); result = tftp_tx(state, event);
break; break;
case TFTP_STATE_FIN: case TFTP_STATE_FIN:
infof(data, "%s\n", "TFTP finished"); infof(data, "%s", "TFTP finished");
break; break;
default: default:
DEBUGF(infof(data, "STATE: %d\n", state->state)); DEBUGF(infof(data, "STATE: %d", state->state));
failf(data, "%s", "Internal state machine error"); failf(data, "%s", "Internal state machine error");
result = CURLE_TFTP_ILLEGAL; result = CURLE_TFTP_ILLEGAL;
break; break;
@ -1153,7 +1153,7 @@ static CURLcode tftp_receive_packet(struct Curl_easy *data)
size_t strn = state->rbytes - 4; size_t strn = state->rbytes - 4;
state->error = (tftp_error_t)error; state->error = (tftp_error_t)error;
if(tftp_strnlen(str, strn) < strn) if(tftp_strnlen(str, strn) < strn)
infof(data, "TFTP error: %s\n", str); infof(data, "TFTP error: %s", str);
break; break;
} }
case TFTP_EVENT_ACK: case TFTP_EVENT_ACK:
@ -1288,7 +1288,7 @@ static CURLcode tftp_doing(struct Curl_easy *data, bool *dophase_done)
result = tftp_multi_statemach(data, dophase_done); result = tftp_multi_statemach(data, dophase_done);
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
else if(!result) { else if(!result) {
/* The multi code doesn't have this logic for the DOING state so we /* The multi code doesn't have this logic for the DOING state so we
@ -1325,7 +1325,7 @@ static CURLcode tftp_perform(struct Curl_easy *data, bool *dophase_done)
tftp_multi_statemach(data, dophase_done); tftp_multi_statemach(data, dophase_done);
if(*dophase_done) if(*dophase_done)
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
return result; return result;
} }

View File

@ -188,7 +188,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
/* at this point we already verified that the callback exists /* at this point we already verified that the callback exists
so we compile and store the trailers buffer, then proceed */ so we compile and store the trailers buffer, then proceed */
infof(data, infof(data,
"Moving trailers state machine from initialized to sending.\n"); "Moving trailers state machine from initialized to sending.");
data->state.trailers_state = TRAILERS_SENDING; data->state.trailers_state = TRAILERS_SENDING;
Curl_dyn_init(&data->state.trailers_buf, DYN_TRAILERS); Curl_dyn_init(&data->state.trailers_buf, DYN_TRAILERS);
@ -211,7 +211,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
curl_slist_free_all(trailers); curl_slist_free_all(trailers);
return result; return result;
} }
infof(data, "Successfully compiled trailers.\r\n"); infof(data, "Successfully compiled trailers.");
curl_slist_free_all(trailers); curl_slist_free_all(trailers);
} }
#endif #endif
@ -376,7 +376,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
data->set.trailer_callback = NULL; data->set.trailer_callback = NULL;
/* mark the transfer as done */ /* mark the transfer as done */
data->req.upload_done = TRUE; data->req.upload_done = TRUE;
infof(data, "Signaling end of chunked upload after trailers.\n"); infof(data, "Signaling end of chunked upload after trailers.");
} }
else else
#endif #endif
@ -385,7 +385,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
/* mark this as done once this chunk is transferred */ /* mark this as done once this chunk is transferred */
data->req.upload_done = TRUE; data->req.upload_done = TRUE;
infof(data, infof(data,
"Signaling end of chunked upload via terminating chunk.\n"); "Signaling end of chunked upload via terminating chunk.");
} }
if(added_crlf) if(added_crlf)
@ -463,7 +463,7 @@ CURLcode Curl_readrewind(struct Curl_easy *data)
err = (data->set.ioctl_func)(data, CURLIOCMD_RESTARTREAD, err = (data->set.ioctl_func)(data, CURLIOCMD_RESTARTREAD,
data->set.ioctl_client); data->set.ioctl_client);
Curl_set_in_callback(data, false); Curl_set_in_callback(data, false);
infof(data, "the ioctl callback returned %d\n", (int)err); infof(data, "the ioctl callback returned %d", (int)err);
if(err) { if(err) {
failf(data, "ioctl callback returned error %d", (int)err); failf(data, "ioctl callback returned error %d", (int)err);
@ -530,7 +530,7 @@ bool Curl_meets_timecondition(struct Curl_easy *data, time_t timeofdoc)
default: default:
if(timeofdoc <= data->set.timevalue) { if(timeofdoc <= data->set.timevalue) {
infof(data, infof(data,
"The requested document is not new enough\n"); "The requested document is not new enough");
data->info.timecond = TRUE; data->info.timecond = TRUE;
return FALSE; return FALSE;
} }
@ -538,7 +538,7 @@ bool Curl_meets_timecondition(struct Curl_easy *data, time_t timeofdoc)
case CURL_TIMECOND_IFUNMODSINCE: case CURL_TIMECOND_IFUNMODSINCE:
if(timeofdoc >= data->set.timevalue) { if(timeofdoc >= data->set.timevalue) {
infof(data, infof(data,
"The requested document is not old enough\n"); "The requested document is not old enough");
data->info.timecond = TRUE; data->info.timecond = TRUE;
return FALSE; return FALSE;
} }
@ -615,7 +615,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
else { else {
/* read nothing but since we wanted nothing we consider this an OK /* read nothing but since we wanted nothing we consider this an OK
situation to proceed from */ situation to proceed from */
DEBUGF(infof(data, "readwrite_data: we're done!\n")); DEBUGF(infof(data, "readwrite_data: we're done!"));
nread = 0; nread = 0;
} }
@ -638,10 +638,10 @@ static CURLcode readwrite_data(struct Curl_easy *data,
server closed the connection and we bail out from this! */ server closed the connection and we bail out from this! */
#ifdef USE_NGHTTP2 #ifdef USE_NGHTTP2
if(is_http2 && !nread) if(is_http2 && !nread)
DEBUGF(infof(data, "nread == 0, stream closed, bailing\n")); DEBUGF(infof(data, "nread == 0, stream closed, bailing"));
else else
#endif #endif
DEBUGF(infof(data, "nread <= 0, server closed connection, bailing\n")); DEBUGF(infof(data, "nread <= 0, server closed connection, bailing"));
k->keepon &= ~KEEP_RECV; k->keepon &= ~KEEP_RECV;
break; break;
} }
@ -684,7 +684,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
infof(data, infof(data,
"Excess found:" "Excess found:"
" excess = %zd" " excess = %zd"
" url = %s (zero-length body)\n", " url = %s (zero-length body)",
nread, data->state.up.path); nread, data->state.up.path);
} }
@ -764,7 +764,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
written to the client. */ written to the client. */
if(conn->chunk.datasize) { if(conn->chunk.datasize) {
infof(data, "Leftovers after chunking: % " infof(data, "Leftovers after chunking: % "
CURL_FORMAT_CURL_OFF_T "u bytes\n", CURL_FORMAT_CURL_OFF_T "u bytes",
conn->chunk.datasize); conn->chunk.datasize);
} }
} }
@ -775,7 +775,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
/* Account for body content stored in the header buffer */ /* Account for body content stored in the header buffer */
if((k->badheader == HEADER_PARTHEADER) && !k->ignorebody) { if((k->badheader == HEADER_PARTHEADER) && !k->ignorebody) {
size_t headlen = Curl_dyn_len(&data->state.headerb); size_t headlen = Curl_dyn_len(&data->state.headerb);
DEBUGF(infof(data, "Increasing bytecount by %zu\n", headlen)); DEBUGF(infof(data, "Increasing bytecount by %zu", headlen));
k->bytecount += headlen; k->bytecount += headlen;
} }
@ -789,7 +789,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
" excess = %zu" " excess = %zu"
", size = %" CURL_FORMAT_CURL_OFF_T ", size = %" CURL_FORMAT_CURL_OFF_T
", maxdownload = %" CURL_FORMAT_CURL_OFF_T ", maxdownload = %" CURL_FORMAT_CURL_OFF_T
", bytecount = %" CURL_FORMAT_CURL_OFF_T "\n", ", bytecount = %" CURL_FORMAT_CURL_OFF_T,
excess, k->size, k->maxdownload, k->bytecount); excess, k->size, k->maxdownload, k->bytecount);
connclose(conn, "excess found in a read"); connclose(conn, "excess found in a read");
} }
@ -898,7 +898,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
/* When we've read the entire thing and the close bit is set, the server /* When we've read the entire thing and the close bit is set, the server
may now close the connection. If there's now any kind of sending going may now close the connection. If there's now any kind of sending going
on from our side, we need to stop that immediately. */ on from our side, we need to stop that immediately. */
infof(data, "we are done reading and this is set to close, stop send\n"); infof(data, "we are done reading and this is set to close, stop send");
k->keepon &= ~KEEP_SEND; /* no writing anymore either */ k->keepon &= ~KEEP_SEND; /* no writing anymore either */
} }
@ -1128,7 +1128,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
(k->writebytecount == data->state.infilesize)) { (k->writebytecount == data->state.infilesize)) {
/* we have sent all data we were supposed to */ /* we have sent all data we were supposed to */
k->upload_done = TRUE; k->upload_done = TRUE;
infof(data, "We are completely uploaded and fine\n"); infof(data, "We are completely uploaded and fine");
} }
if(k->upload_present != bytes_written) { if(k->upload_present != bytes_written) {
@ -1199,7 +1199,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(data->state.drain) { if(data->state.drain) {
select_res |= CURL_CSELECT_IN; select_res |= CURL_CSELECT_IN;
DEBUGF(infof(data, "Curl_readwrite: forcibly told to drain data\n")); DEBUGF(infof(data, "Curl_readwrite: forcibly told to drain data"));
} }
if(!select_res) /* Call for select()/poll() only, if read/write/error if(!select_res) /* Call for select()/poll() only, if read/write/error
@ -1263,7 +1263,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k->exp100 = EXP100_SEND_DATA; k->exp100 = EXP100_SEND_DATA;
k->keepon |= KEEP_SEND; k->keepon |= KEEP_SEND;
Curl_expire_done(data, EXPIRE_100_TIMEOUT); Curl_expire_done(data, EXPIRE_100_TIMEOUT);
infof(data, "Done waiting for 100-continue\n"); infof(data, "Done waiting for 100-continue");
} }
} }
} }
@ -1679,7 +1679,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
data->state.url = newurl; data->state.url = newurl;
data->state.url_alloc = TRUE; data->state.url_alloc = TRUE;
infof(data, "Issue another request to this URL: '%s'\n", data->state.url); infof(data, "Issue another request to this URL: '%s'", data->state.url);
/* /*
* We get here when the HTTP code is 300-399 (and 401). We need to perform * We get here when the HTTP code is 300-399 (and 401). We need to perform
@ -1722,7 +1722,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
|| data->state.httpreq == HTTPREQ_POST_FORM || data->state.httpreq == HTTPREQ_POST_FORM
|| data->state.httpreq == HTTPREQ_POST_MIME) || data->state.httpreq == HTTPREQ_POST_MIME)
&& !(data->set.keep_post & CURL_REDIR_POST_301)) { && !(data->set.keep_post & CURL_REDIR_POST_301)) {
infof(data, "Switch from POST to GET\n"); infof(data, "Switch from POST to GET");
data->state.httpreq = HTTPREQ_GET; data->state.httpreq = HTTPREQ_GET;
} }
break; break;
@ -1747,7 +1747,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
|| data->state.httpreq == HTTPREQ_POST_FORM || data->state.httpreq == HTTPREQ_POST_FORM
|| data->state.httpreq == HTTPREQ_POST_MIME) || data->state.httpreq == HTTPREQ_POST_MIME)
&& !(data->set.keep_post & CURL_REDIR_POST_302)) { && !(data->set.keep_post & CURL_REDIR_POST_302)) {
infof(data, "Switch from POST to GET\n"); infof(data, "Switch from POST to GET");
data->state.httpreq = HTTPREQ_GET; data->state.httpreq = HTTPREQ_GET;
} }
break; break;
@ -1765,7 +1765,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
!(data->set.keep_post & CURL_REDIR_POST_303))) { !(data->set.keep_post & CURL_REDIR_POST_303))) {
data->state.httpreq = HTTPREQ_GET; data->state.httpreq = HTTPREQ_GET;
data->set.upload = false; data->set.upload = false;
infof(data, "Switch to %s\n", infof(data, "Switch to %s",
data->set.opt_no_body?"HEAD":"GET"); data->set.opt_no_body?"HEAD":"GET");
} }
break; break;
@ -1826,7 +1826,7 @@ CURLcode Curl_retry_request(struct Curl_easy *data, char **url)
to issue again, but the nghttp2 API can deliver the message to other to issue again, but the nghttp2 API can deliver the message to other
streams as well, which is why this adds the check the data counters streams as well, which is why this adds the check the data counters
too. */ too. */
infof(data, "REFUSED_STREAM, retrying a fresh connect\n"); infof(data, "REFUSED_STREAM, retrying a fresh connect");
data->state.refused_stream = FALSE; /* clear again */ data->state.refused_stream = FALSE; /* clear again */
retry = TRUE; retry = TRUE;
} }
@ -1838,8 +1838,8 @@ CURLcode Curl_retry_request(struct Curl_easy *data, char **url)
data->state.retrycount = 0; data->state.retrycount = 0;
return CURLE_SEND_ERROR; return CURLE_SEND_ERROR;
} }
infof(data, "Connection died, retrying a fresh connect\ infof(data, "Connection died, retrying a fresh connect (retry count: %d)",
(retry count: %d)\n", data->state.retrycount); data->state.retrycount);
*url = strdup(data->state.url); *url = strdup(data->state.url);
if(!*url) if(!*url)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;

View File

@ -733,7 +733,7 @@ static void conn_shutdown(struct Curl_easy *data, struct connectdata *conn)
{ {
DEBUGASSERT(conn); DEBUGASSERT(conn);
DEBUGASSERT(data); DEBUGASSERT(data);
infof(data, "Closing connection %ld\n", conn->connection_id); infof(data, "Closing connection %ld", conn->connection_id);
#ifndef USE_HYPER #ifndef USE_HYPER
if(conn->connect_state && conn->connect_state->prot_save) { if(conn->connect_state && conn->connect_state->prot_save) {
@ -840,7 +840,7 @@ CURLcode Curl_disconnect(struct Curl_easy *data,
* are other users of it * are other users of it
*/ */
if(CONN_INUSE(conn) && !dead_connection) { if(CONN_INUSE(conn) && !dead_connection) {
DEBUGF(infof(data, "Curl_disconnect when inuse: %zu\n", CONN_INUSE(conn))); DEBUGF(infof(data, "Curl_disconnect when inuse: %zu", CONN_INUSE(conn)));
return CURLE_OK; return CURLE_OK;
} }
@ -973,7 +973,7 @@ static bool conn_maxage(struct Curl_easy *data,
idletime /= 1000; /* integer seconds is fine */ idletime /= 1000; /* integer seconds is fine */
if(idletime > data->set.maxage_conn) { if(idletime > data->set.maxage_conn) {
infof(data, "Too old connection (%ld seconds), disconnect it\n", infof(data, "Too old connection (%ld seconds), disconnect it",
idletime); idletime);
return TRUE; return TRUE;
} }
@ -1022,7 +1022,7 @@ static bool extract_if_dead(struct connectdata *conn,
} }
if(dead) { if(dead) {
infof(data, "Connection %ld seems to be dead!\n", conn->connection_id); infof(data, "Connection %ld seems to be dead!", conn->connection_id);
Curl_conncache_remove_conn(data, conn, FALSE); Curl_conncache_remove_conn(data, conn, FALSE);
return TRUE; return TRUE;
} }
@ -1138,7 +1138,7 @@ ConnectionExists(struct Curl_easy *data,
/* Max pipe length is zero (unlimited) for multiplexed connections */ /* Max pipe length is zero (unlimited) for multiplexed connections */
struct Curl_llist_element *curr; struct Curl_llist_element *curr;
infof(data, "Found bundle for host %s: %p [%s]\n", infof(data, "Found bundle for host %s: %p [%s]",
hostbundle, (void *)bundle, (bundle->multiuse == BUNDLE_MULTIPLEX ? hostbundle, (void *)bundle, (bundle->multiuse == BUNDLE_MULTIPLEX ?
"can multiplex" : "serially")); "can multiplex" : "serially"));
@ -1146,22 +1146,22 @@ ConnectionExists(struct Curl_easy *data,
if(canmultiplex) { if(canmultiplex) {
if(bundle->multiuse == BUNDLE_UNKNOWN) { if(bundle->multiuse == BUNDLE_UNKNOWN) {
if(data->set.pipewait) { if(data->set.pipewait) {
infof(data, "Server doesn't support multiplex yet, wait\n"); infof(data, "Server doesn't support multiplex yet, wait");
*waitpipe = TRUE; *waitpipe = TRUE;
CONNCACHE_UNLOCK(data); CONNCACHE_UNLOCK(data);
return FALSE; /* no re-use */ return FALSE; /* no re-use */
} }
infof(data, "Server doesn't support multiplex (yet)\n"); infof(data, "Server doesn't support multiplex (yet)");
canmultiplex = FALSE; canmultiplex = FALSE;
} }
if((bundle->multiuse == BUNDLE_MULTIPLEX) && if((bundle->multiuse == BUNDLE_MULTIPLEX) &&
!Curl_multiplex_wanted(data->multi)) { !Curl_multiplex_wanted(data->multi)) {
infof(data, "Could multiplex, but not asked to!\n"); infof(data, "Could multiplex, but not asked to!");
canmultiplex = FALSE; canmultiplex = FALSE;
} }
if(bundle->multiuse == BUNDLE_NO_MULTIUSE) { if(bundle->multiuse == BUNDLE_NO_MULTIUSE) {
infof(data, "Can not multiplex, even if we wanted to!\n"); infof(data, "Can not multiplex, even if we wanted to!");
canmultiplex = FALSE; canmultiplex = FALSE;
} }
} }
@ -1209,7 +1209,7 @@ ConnectionExists(struct Curl_easy *data,
completed yet and until then we don't re-use this connection */ completed yet and until then we don't re-use this connection */
if(!check->primary_ip[0]) { if(!check->primary_ip[0]) {
infof(data, infof(data,
"Connection #%ld is still name resolving, can't reuse\n", "Connection #%ld is still name resolving, can't reuse",
check->connection_id); check->connection_id);
continue; continue;
} }
@ -1218,7 +1218,7 @@ ConnectionExists(struct Curl_easy *data,
if(check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) { if(check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) {
foundPendingCandidate = TRUE; foundPendingCandidate = TRUE;
/* Don't pick a connection that hasn't connected yet */ /* Don't pick a connection that hasn't connected yet */
infof(data, "Connection #%ld isn't open enough, can't reuse\n", infof(data, "Connection #%ld isn't open enough, can't reuse",
check->connection_id); check->connection_id);
continue; continue;
} }
@ -1373,7 +1373,7 @@ ConnectionExists(struct Curl_easy *data,
&check->ssl_config)) { &check->ssl_config)) {
DEBUGF(infof(data, DEBUGF(infof(data,
"Connection #%ld has different SSL parameters, " "Connection #%ld has different SSL parameters, "
"can't reuse\n", "can't reuse",
check->connection_id)); check->connection_id));
continue; continue;
} }
@ -1381,7 +1381,7 @@ ConnectionExists(struct Curl_easy *data,
foundPendingCandidate = TRUE; foundPendingCandidate = TRUE;
DEBUGF(infof(data, DEBUGF(infof(data,
"Connection #%ld has not started SSL connect, " "Connection #%ld has not started SSL connect, "
"can't reuse\n", "can't reuse",
check->connection_id)); check->connection_id));
continue; continue;
} }
@ -1468,14 +1468,14 @@ ConnectionExists(struct Curl_easy *data,
/* Multiplexed connections can only be HTTP/2 for now */ /* Multiplexed connections can only be HTTP/2 for now */
struct http_conn *httpc = &check->proto.httpc; struct http_conn *httpc = &check->proto.httpc;
if(multiplexed >= httpc->settings.max_concurrent_streams) { if(multiplexed >= httpc->settings.max_concurrent_streams) {
infof(data, "MAX_CONCURRENT_STREAMS reached, skip (%zu)\n", infof(data, "MAX_CONCURRENT_STREAMS reached, skip (%zu)",
multiplexed); multiplexed);
continue; continue;
} }
else if(multiplexed >= else if(multiplexed >=
Curl_multi_max_concurrent_streams(data->multi)) { Curl_multi_max_concurrent_streams(data->multi)) {
infof(data, "client side MAX_CONCURRENT_STREAMS reached" infof(data, "client side MAX_CONCURRENT_STREAMS reached"
", skip (%zu)\n", ", skip (%zu)",
multiplexed); multiplexed);
continue; continue;
} }
@ -1483,7 +1483,7 @@ ConnectionExists(struct Curl_easy *data,
#endif #endif
/* When not multiplexed, we have a match here! */ /* When not multiplexed, we have a match here! */
chosen = check; chosen = check;
infof(data, "Multiplexed connection found!\n"); infof(data, "Multiplexed connection found!");
break; break;
} }
else { else {
@ -1506,7 +1506,7 @@ ConnectionExists(struct Curl_easy *data,
if(foundPendingCandidate && data->set.pipewait) { if(foundPendingCandidate && data->set.pipewait) {
infof(data, infof(data,
"Found pending candidate for reuse and CURLOPT_PIPEWAIT is set\n"); "Found pending candidate for reuse and CURLOPT_PIPEWAIT is set");
*waitpipe = TRUE; *waitpipe = TRUE;
} }
@ -1521,7 +1521,7 @@ void Curl_verboseconnect(struct Curl_easy *data,
struct connectdata *conn) struct connectdata *conn)
{ {
if(data->set.verbose) if(data->set.verbose)
infof(data, "Connected to %s (%s) port %u (#%ld)\n", infof(data, "Connected to %s (%s) port %u (#%ld)",
#ifndef CURL_DISABLE_PROXY #ifndef CURL_DISABLE_PROXY
conn->bits.socksproxy ? conn->socks_proxy.host.dispname : conn->bits.socksproxy ? conn->socks_proxy.host.dispname :
conn->bits.httpproxy ? conn->http_proxy.host.dispname : conn->bits.httpproxy ? conn->http_proxy.host.dispname :
@ -1625,7 +1625,7 @@ CURLcode Curl_idnconvert_hostname(struct Curl_easy *data,
return CURLE_URL_MALFORMAT; return CURLE_URL_MALFORMAT;
} }
#else #else
infof(data, "IDN support not present, can't parse Unicode domains\n"); infof(data, "IDN support not present, can't parse Unicode domains");
#endif #endif
} }
return CURLE_OK; return CURLE_OK;
@ -1893,7 +1893,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
scopeidx = if_nametoindex(zoneid); scopeidx = if_nametoindex(zoneid);
#endif #endif
if(!scopeidx) if(!scopeidx)
infof(data, "Invalid zoneid: %s; %s\n", zoneid, infof(data, "Invalid zoneid: %s; %s", zoneid,
strerror(errno)); strerror(errno));
else else
conn->scope_id = scopeidx; conn->scope_id = scopeidx;
@ -1950,7 +1950,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
CURLU_DISALLOW_USER : 0) | CURLU_DISALLOW_USER : 0) |
(data->set.path_as_is ? CURLU_PATH_AS_IS : 0)); (data->set.path_as_is ? CURLU_PATH_AS_IS : 0));
if(uc) { if(uc) {
DEBUGF(infof(data, "curl_url_set rejected %s\n", data->state.url)); DEBUGF(infof(data, "curl_url_set rejected %s", data->state.url));
return Curl_uc_to_curlcode(uc); return Curl_uc_to_curlcode(uc);
} }
@ -1995,7 +1995,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
} }
data->state.url = url; data->state.url = url;
data->state.url_alloc = TRUE; data->state.url_alloc = TRUE;
infof(data, "Switched from HTTP to HTTPS due to HSTS => %s\n", infof(data, "Switched from HTTP to HTTPS due to HSTS => %s",
data->state.url); data->state.url);
} }
} }
@ -2349,7 +2349,7 @@ static char *detect_proxy(struct Curl_easy *data,
} }
} }
if(proxy) if(proxy)
infof(data, "Uses proxy env variable %s == '%s'\n", envp, proxy); infof(data, "Uses proxy env variable %s == '%s'", envp, proxy);
return proxy; return proxy;
} }
@ -2592,7 +2592,7 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
no_proxy = curl_getenv(p); no_proxy = curl_getenv(p);
} }
if(no_proxy) { if(no_proxy) {
infof(data, "Uses proxy env variable %s == '%s'\n", p, no_proxy); infof(data, "Uses proxy env variable %s == '%s'", p, no_proxy);
} }
} }
@ -2911,7 +2911,7 @@ static CURLcode override_login(struct Curl_easy *data,
&netrc_user_changed, &netrc_passwd_changed, &netrc_user_changed, &netrc_passwd_changed,
data->set.str[STRING_NETRC_FILE]); data->set.str[STRING_NETRC_FILE]);
if(ret > 0) { if(ret > 0) {
infof(data, "Couldn't find host %s in the %s file; using defaults\n", infof(data, "Couldn't find host %s in the %s file; using defaults",
conn->host.name, data->set.str[STRING_NETRC_FILE]); conn->host.name, data->set.str[STRING_NETRC_FILE]);
} }
else if(ret < 0) { else if(ret < 0) {
@ -3042,7 +3042,7 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data,
if(*ptr == '%') { if(*ptr == '%') {
/* There might be a zone identifier */ /* There might be a zone identifier */
if(strncmp("%25", ptr, 3)) if(strncmp("%25", ptr, 3))
infof(data, "Please URL encode %% as %%25, see RFC 6874.\n"); infof(data, "Please URL encode %% as %%25, see RFC 6874.");
ptr++; ptr++;
/* Allow unreserved characters as defined in RFC 3986 */ /* Allow unreserved characters as defined in RFC 3986 */
while(*ptr && (ISALPHA(*ptr) || ISXDIGIT(*ptr) || (*ptr == '-') || while(*ptr && (ISALPHA(*ptr) || ISXDIGIT(*ptr) || (*ptr == '-') ||
@ -3053,7 +3053,7 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data,
/* yeps, it ended nicely with a bracket as well */ /* yeps, it ended nicely with a bracket as well */
*ptr++ = '\0'; *ptr++ = '\0';
else else
infof(data, "Invalid IPv6 address format\n"); infof(data, "Invalid IPv6 address format");
portptr = ptr; portptr = ptr;
/* Note that if this didn't end with a bracket, we still advanced the /* Note that if this didn't end with a bracket, we still advanced the
* hostptr first, but I can't see anything wrong with that as no host * hostptr first, but I can't see anything wrong with that as no host
@ -3194,7 +3194,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
conn->conn_to_host.name = host; conn->conn_to_host.name = host;
conn->bits.conn_to_host = TRUE; conn->bits.conn_to_host = TRUE;
infof(data, "Connecting to hostname: %s\n", host); infof(data, "Connecting to hostname: %s", host);
} }
else { else {
/* no "connect to host" */ /* no "connect to host" */
@ -3205,7 +3205,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
if(port >= 0) { if(port >= 0) {
conn->conn_to_port = port; conn->conn_to_port = port;
conn->bits.conn_to_port = TRUE; conn->bits.conn_to_port = TRUE;
infof(data, "Connecting to port: %d\n", port); infof(data, "Connecting to port: %d", port);
} }
else { else {
/* no "connect to port" */ /* no "connect to port" */
@ -3266,7 +3266,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
conn->conn_to_port = as->dst.port; conn->conn_to_port = as->dst.port;
conn->bits.conn_to_port = TRUE; conn->bits.conn_to_port = TRUE;
conn->bits.altused = TRUE; conn->bits.altused = TRUE;
infof(data, "Alt-svc connecting from [%s]%s:%d to [%s]%s:%d\n", infof(data, "Alt-svc connecting from [%s]%s:%d to [%s]%s:%d",
Curl_alpnid2str(srcalpnid), host, conn->remote_port, Curl_alpnid2str(srcalpnid), host, conn->remote_port,
Curl_alpnid2str(as->dst.alpnid), hostd, as->dst.port); Curl_alpnid2str(as->dst.alpnid), hostd, as->dst.port);
if(srcalpnid != as->dst.alpnid) { if(srcalpnid != as->dst.alpnid) {
@ -3862,14 +3862,14 @@ static CURLcode create_conn(struct Curl_easy *data,
*in_connect = conn; *in_connect = conn;
#ifndef CURL_DISABLE_PROXY #ifndef CURL_DISABLE_PROXY
infof(data, "Re-using existing connection! (#%ld) with %s %s\n", infof(data, "Re-using existing connection! (#%ld) with %s %s",
conn->connection_id, conn->connection_id,
conn->bits.proxy?"proxy":"host", conn->bits.proxy?"proxy":"host",
conn->socks_proxy.host.name ? conn->socks_proxy.host.dispname : conn->socks_proxy.host.name ? conn->socks_proxy.host.dispname :
conn->http_proxy.host.name ? conn->http_proxy.host.dispname : conn->http_proxy.host.name ? conn->http_proxy.host.dispname :
conn->host.dispname); conn->host.dispname);
#else #else
infof(data, "Re-using existing connection! (#%ld) with host %s\n", infof(data, "Re-using existing connection! (#%ld) with host %s",
conn->connection_id, conn->host.dispname); conn->connection_id, conn->host.dispname);
#endif #endif
} }
@ -3909,7 +3909,7 @@ static CURLcode create_conn(struct Curl_easy *data,
if(conn_candidate) if(conn_candidate)
(void)Curl_disconnect(data, conn_candidate, FALSE); (void)Curl_disconnect(data, conn_candidate, FALSE);
else { else {
infof(data, "No more connections allowed to host %s: %zu\n", infof(data, "No more connections allowed to host %s: %zu",
bundlehost, max_host_connections); bundlehost, max_host_connections);
connections_available = FALSE; connections_available = FALSE;
} }
@ -3929,13 +3929,13 @@ static CURLcode create_conn(struct Curl_easy *data,
if(conn_candidate) if(conn_candidate)
(void)Curl_disconnect(data, conn_candidate, FALSE); (void)Curl_disconnect(data, conn_candidate, FALSE);
else { else {
infof(data, "No connections available in cache\n"); infof(data, "No connections available in cache");
connections_available = FALSE; connections_available = FALSE;
} }
} }
if(!connections_available) { if(!connections_available) {
infof(data, "No connections available.\n"); infof(data, "No connections available.");
conn_free(conn); conn_free(conn);
*in_connect = NULL; *in_connect = NULL;
@ -3960,14 +3960,14 @@ static CURLcode create_conn(struct Curl_easy *data,
connection based. */ connection based. */
if((data->state.authhost.picked & (CURLAUTH_NTLM | CURLAUTH_NTLM_WB)) && if((data->state.authhost.picked & (CURLAUTH_NTLM | CURLAUTH_NTLM_WB)) &&
data->state.authhost.done) { data->state.authhost.done) {
infof(data, "NTLM picked AND auth done set, clear picked!\n"); infof(data, "NTLM picked AND auth done set, clear picked!");
data->state.authhost.picked = CURLAUTH_NONE; data->state.authhost.picked = CURLAUTH_NONE;
data->state.authhost.done = FALSE; data->state.authhost.done = FALSE;
} }
if((data->state.authproxy.picked & (CURLAUTH_NTLM | CURLAUTH_NTLM_WB)) && if((data->state.authproxy.picked & (CURLAUTH_NTLM | CURLAUTH_NTLM_WB)) &&
data->state.authproxy.done) { data->state.authproxy.done) {
infof(data, "NTLM-proxy picked AND auth done set, clear picked!\n"); infof(data, "NTLM-proxy picked AND auth done set, clear picked!");
data->state.authproxy.picked = CURLAUTH_NONE; data->state.authproxy.picked = CURLAUTH_NONE;
data->state.authproxy.done = FALSE; data->state.authproxy.done = FALSE;
} }

View File

@ -112,7 +112,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
/* Ensure we have a valid challenge message */ /* Ensure we have a valid challenge message */
if(!Curl_bufref_len(chlg)) { if(!Curl_bufref_len(chlg)) {
infof(data, "DIGEST-MD5 handshake failure (empty challenge message)\n"); infof(data, "DIGEST-MD5 handshake failure (empty challenge message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -207,7 +207,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
if(status == SEC_E_INSUFFICIENT_MEMORY) if(status == SEC_E_INSUFFICIENT_MEMORY)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
infof(data, "schannel: InitializeSecurityContext failed: %s\n", infof(data, "schannel: InitializeSecurityContext failed: %s",
Curl_sspi_strerror(status, buffer, sizeof(buffer))); Curl_sspi_strerror(status, buffer, sizeof(buffer)));
return CURLE_AUTH_ERROR; return CURLE_AUTH_ERROR;
@ -461,7 +461,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
if(status == SEC_E_OK) if(status == SEC_E_OK)
output_token_len = chlg_buf[4].cbBuffer; output_token_len = chlg_buf[4].cbBuffer;
else { /* delete the context so a new one can be made */ else { /* delete the context so a new one can be made */
infof(data, "digest_sspi: MakeSignature failed, error 0x%08lx\n", infof(data, "digest_sspi: MakeSignature failed, error 0x%08lx",
(long)status); (long)status);
s_pSecFn->DeleteSecurityContext(digest->http_context); s_pSecFn->DeleteSecurityContext(digest->http_context);
Curl_safefree(digest->http_context); Curl_safefree(digest->http_context);
@ -597,7 +597,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
if(status == SEC_E_INSUFFICIENT_MEMORY) if(status == SEC_E_INSUFFICIENT_MEMORY)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
infof(data, "schannel: InitializeSecurityContext failed: %s\n", infof(data, "schannel: InitializeSecurityContext failed: %s",
Curl_sspi_strerror(status, buffer, sizeof(buffer))); Curl_sspi_strerror(status, buffer, sizeof(buffer)));
return CURLE_AUTH_ERROR; return CURLE_AUTH_ERROR;

View File

@ -123,7 +123,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
if(chlg) { if(chlg) {
if(!Curl_bufref_len(chlg)) { if(!Curl_bufref_len(chlg)) {
infof(data, "GSSAPI handshake failure (empty challenge message)\n"); infof(data, "GSSAPI handshake failure (empty challenge message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
input_token.value = (void *) Curl_bufref_ptr(chlg); input_token.value = (void *) Curl_bufref_ptr(chlg);
@ -199,7 +199,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
/* Ensure we have a valid challenge message */ /* Ensure we have a valid challenge message */
if(!Curl_bufref_len(chlg)) { if(!Curl_bufref_len(chlg)) {
infof(data, "GSSAPI handshake failure (empty security message)\n"); infof(data, "GSSAPI handshake failure (empty security message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -238,7 +238,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
/* Not 4 octets long so fail as per RFC4752 Section 3.1 */ /* Not 4 octets long so fail as per RFC4752 Section 3.1 */
if(output_token.length != 4) { if(output_token.length != 4) {
infof(data, "GSSAPI handshake failure (invalid security data)\n"); infof(data, "GSSAPI handshake failure (invalid security data)");
gss_release_buffer(&unused_status, &username_token); gss_release_buffer(&unused_status, &username_token);
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -250,7 +250,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
/* Extract the security layer */ /* Extract the security layer */
sec_layer = indata & 0x000000FF; sec_layer = indata & 0x000000FF;
if(!(sec_layer & GSSAUTH_P_NONE)) { if(!(sec_layer & GSSAUTH_P_NONE)) {
infof(data, "GSSAPI handshake failure (invalid security layer)\n"); infof(data, "GSSAPI handshake failure (invalid security layer)");
gss_release_buffer(&unused_status, &username_token); gss_release_buffer(&unused_status, &username_token);
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;

View File

@ -173,7 +173,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
if(chlg) { if(chlg) {
if(!Curl_bufref_len(chlg)) { if(!Curl_bufref_len(chlg)) {
infof(data, "GSSAPI handshake failure (empty challenge message)\n"); infof(data, "GSSAPI handshake failure (empty challenge message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -272,7 +272,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
/* Ensure we have a valid challenge message */ /* Ensure we have a valid challenge message */
if(!Curl_bufref_len(chlg)) { if(!Curl_bufref_len(chlg)) {
infof(data, "GSSAPI handshake failure (empty security message)\n"); infof(data, "GSSAPI handshake failure (empty security message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -312,13 +312,13 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
/* Decrypt the inbound challenge and obtain the qop */ /* Decrypt the inbound challenge and obtain the qop */
status = s_pSecFn->DecryptMessage(krb5->context, &input_desc, 0, &qop); status = s_pSecFn->DecryptMessage(krb5->context, &input_desc, 0, &qop);
if(status != SEC_E_OK) { if(status != SEC_E_OK) {
infof(data, "GSSAPI handshake failure (empty security message)\n"); infof(data, "GSSAPI handshake failure (empty security message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
/* Not 4 octets long so fail as per RFC4752 Section 3.1 */ /* Not 4 octets long so fail as per RFC4752 Section 3.1 */
if(input_buf[1].cbBuffer != 4) { if(input_buf[1].cbBuffer != 4) {
infof(data, "GSSAPI handshake failure (invalid security data)\n"); infof(data, "GSSAPI handshake failure (invalid security data)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -329,7 +329,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
/* Extract the security layer */ /* Extract the security layer */
sec_layer = indata & 0x000000FF; sec_layer = indata & 0x000000FF;
if(!(sec_layer & KERB_WRAP_NO_ENCRYPT)) { if(!(sec_layer & KERB_WRAP_NO_ENCRYPT)) {
infof(data, "GSSAPI handshake failure (invalid security layer)\n"); infof(data, "GSSAPI handshake failure (invalid security layer)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }

View File

@ -182,7 +182,7 @@ static CURLcode ntlm_decode_type2_target(struct Curl_easy *data,
(target_info_offset + target_info_len) > type2len || (target_info_offset + target_info_len) > type2len ||
target_info_offset < 48) { target_info_offset < 48) {
infof(data, "NTLM handshake failure (bad type-2 message). " infof(data, "NTLM handshake failure (bad type-2 message). "
"Target Info Offset Len is set incorrect by the peer\n"); "Target Info Offset Len is set incorrect by the peer");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -286,7 +286,7 @@ CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
(memcmp(type2, NTLMSSP_SIGNATURE, 8) != 0) || (memcmp(type2, NTLMSSP_SIGNATURE, 8) != 0) ||
(memcmp(type2 + 8, type2_marker, sizeof(type2_marker)) != 0)) { (memcmp(type2 + 8, type2_marker, sizeof(type2_marker)) != 0)) {
/* This was not a good enough type-2 message */ /* This was not a good enough type-2 message */
infof(data, "NTLM handshake failure (bad type-2 message)\n"); infof(data, "NTLM handshake failure (bad type-2 message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -296,7 +296,7 @@ CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
if(ntlm->flags & NTLMFLAG_NEGOTIATE_TARGET_INFO) { if(ntlm->flags & NTLMFLAG_NEGOTIATE_TARGET_INFO) {
result = ntlm_decode_type2_target(data, type2ref, ntlm); result = ntlm_decode_type2_target(data, type2ref, ntlm);
if(result) { if(result) {
infof(data, "NTLM handshake failure (bad type-2 message)\n"); infof(data, "NTLM handshake failure (bad type-2 message)");
return result; return result;
} }
} }
@ -533,7 +533,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
/* Get the machine's un-qualified host name as NTLM doesn't like the fully /* Get the machine's un-qualified host name as NTLM doesn't like the fully
qualified domain name */ qualified domain name */
if(Curl_gethostname(host, sizeof(host))) { if(Curl_gethostname(host, sizeof(host))) {
infof(data, "gethostname() failed, continuing without!\n"); infof(data, "gethostname() failed, continuing without!");
hostlen = 0; hostlen = 0;
} }
else { else {

View File

@ -206,7 +206,7 @@ CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
/* Ensure we have a valid type-2 message */ /* Ensure we have a valid type-2 message */
if(!Curl_bufref_len(type2)) { if(!Curl_bufref_len(type2)) {
infof(data, "NTLM handshake failure (empty type-2 message)\n"); infof(data, "NTLM handshake failure (empty type-2 message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }
@ -309,7 +309,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
&type_3_desc, &type_3_desc,
&attrs, &expiry); &attrs, &expiry);
if(status != SEC_E_OK) { if(status != SEC_E_OK) {
infof(data, "NTLM handshake failure (type-3 message): Status=%x\n", infof(data, "NTLM handshake failure (type-3 message): Status=%x",
status); status);
if(status == SEC_E_INSUFFICIENT_MEMORY) if(status == SEC_E_INSUFFICIENT_MEMORY)

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -137,8 +137,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
/* Ensure we have a valid challenge message */ /* Ensure we have a valid challenge message */
if(!chlg) { if(!chlg) {
infof(data, "SPNEGO handshake failure (empty challenge message)\n"); infof(data, "SPNEGO handshake failure (empty challenge message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -191,8 +191,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
/* Ensure we have a valid challenge message */ /* Ensure we have a valid challenge message */
if(!chlg) { if(!chlg) {
infof(data, "SPNEGO handshake failure (empty challenge message)\n"); infof(data, "SPNEGO handshake failure (empty challenge message)");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }

View File

@ -779,7 +779,7 @@ CURLcode Curl_quic_connect(struct Curl_easy *data,
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_BAD_FUNCTION_ARGUMENT;
} }
infof(data, "Connect socket %d over QUIC to %s:%d\n", infof(data, "Connect socket %d over QUIC to %s:%d",
sockfd, ipbuf, port); sockfd, ipbuf, port);
qs->version = NGTCP2_PROTO_VER_MAX; qs->version = NGTCP2_PROTO_VER_MAX;
@ -951,7 +951,7 @@ static int cb_h3_stream_close(nghttp3_conn *conn, int64_t stream_id,
(void)stream_id; (void)stream_id;
(void)app_error_code; (void)app_error_code;
(void)user_data; (void)user_data;
H3BUGF(infof(data, "cb_h3_stream_close CALLED\n")); H3BUGF(infof(data, "cb_h3_stream_close CALLED"));
stream->closed = TRUE; stream->closed = TRUE;
Curl_expire(data, 0, EXPIRE_QUIC); Curl_expire(data, 0, EXPIRE_QUIC);
@ -1287,7 +1287,7 @@ static ssize_t ngh3_stream_recv(struct Curl_easy *data,
return 0; return 0;
} }
infof(data, "ngh3_stream_recv returns 0 bytes and EAGAIN\n"); infof(data, "ngh3_stream_recv returns 0 bytes and EAGAIN");
*curlcode = CURLE_AGAIN; *curlcode = CURLE_AGAIN;
return -1; return -1;
} }
@ -1304,7 +1304,7 @@ static int cb_h3_acked_stream_data(nghttp3_conn *conn, int64_t stream_id,
if(!data->set.postfields) { if(!data->set.postfields) {
stream->h3out->used -= datalen; stream->h3out->used -= datalen;
H3BUGF(infof(data, H3BUGF(infof(data,
"cb_h3_acked_stream_data, %zd bytes, %zd left unacked\n", "cb_h3_acked_stream_data, %zd bytes, %zd left unacked",
datalen, stream->h3out->used)); datalen, stream->h3out->used));
DEBUGASSERT(stream->h3out->used < H3_SEND_SIZE); DEBUGASSERT(stream->h3out->used < H3_SEND_SIZE);
@ -1366,13 +1366,13 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
if(!stream->upload_left) if(!stream->upload_left)
*pflags = NGHTTP3_DATA_FLAG_EOF; *pflags = NGHTTP3_DATA_FLAG_EOF;
} }
H3BUGF(infof(data, "cb_h3_readfunction %zd bytes%s (at %zd unacked)\n", H3BUGF(infof(data, "cb_h3_readfunction %zd bytes%s (at %zd unacked)",
nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"", nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
out->used)); out->used));
} }
if(stream->upload_done && !stream->upload_len && if(stream->upload_done && !stream->upload_len &&
(stream->upload_left <= 0)) { (stream->upload_left <= 0)) {
H3BUGF(infof(data, "!!!!!!!!! cb_h3_readfunction sets EOF\n")); H3BUGF(infof(data, "!!!!!!!!! cb_h3_readfunction sets EOF"));
*pflags = NGHTTP3_DATA_FLAG_EOF; *pflags = NGHTTP3_DATA_FLAG_EOF;
return nread ? 1 : 0; return nread ? 1 : 0;
} }
@ -1565,7 +1565,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
if(acc > MAX_ACC) { if(acc > MAX_ACC) {
infof(data, "http_request: Warning: The cumulative length of all " infof(data, "http_request: Warning: The cumulative length of all "
"headers exceeds %d bytes and that could cause the " "headers exceeds %d bytes and that could cause the "
"stream to be rejected.\n", MAX_ACC); "stream to be rejected.", MAX_ACC);
} }
} }
@ -1611,7 +1611,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
Curl_safefree(nva); Curl_safefree(nva);
infof(data, "Using HTTP/3 Stream ID: %x (easy handle %p)\n", infof(data, "Using HTTP/3 Stream ID: %x (easy handle %p)",
stream3_id, (void *)data); stream3_id, (void *)data);
return CURLE_OK; return CURLE_OK;
@ -1641,7 +1641,7 @@ static ssize_t ngh3_stream_send(struct Curl_easy *data,
sent = len; sent = len;
} }
else { else {
H3BUGF(infof(data, "ngh3_stream_send() wants to send %zd bytes\n", H3BUGF(infof(data, "ngh3_stream_send() wants to send %zd bytes",
len)); len));
if(!stream->upload_len) { if(!stream->upload_len) {
stream->upload_mem = mem; stream->upload_mem = mem;

View File

@ -258,7 +258,7 @@ CURLcode Curl_quic_connect(struct Curl_easy *data,
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_BAD_FUNCTION_ARGUMENT;
} }
infof(data, "Connect socket %d over QUIC to %s:%ld\n", infof(data, "Connect socket %d over QUIC to %s:%ld",
sockfd, ipbuf, port); sockfd, ipbuf, port);
Curl_persistconninfo(data, conn, NULL, -1); Curl_persistconninfo(data, conn, NULL, -1);
@ -277,7 +277,7 @@ CURLcode Curl_quic_connect(struct Curl_easy *data,
offset += 1 + alpn_len; offset += 1 + alpn_len;
} }
infof(data, "Sent QUIC client Initial, ALPN: %s\n", infof(data, "Sent QUIC client Initial, ALPN: %s",
alpn_protocols + 1); alpn_protocols + 1);
} }
@ -345,7 +345,7 @@ CURLcode Curl_quic_is_connected(struct Curl_easy *data,
if(quiche_conn_is_established(qs->conn)) { if(quiche_conn_is_established(qs->conn)) {
*done = TRUE; *done = TRUE;
result = quiche_has_connected(conn, 0, sockindex); result = quiche_has_connected(conn, 0, sockindex);
DEBUGF(infof(data, "quiche established connection!\n")); DEBUGF(infof(data, "quiche established connection!"));
} }
return result; return result;
@ -491,7 +491,7 @@ static ssize_t h3_stream_recv(struct Curl_easy *data,
headers.nlen = 0; headers.nlen = 0;
if(process_ingress(data, sockfd, qs)) { if(process_ingress(data, sockfd, qs)) {
infof(data, "h3_stream_recv returns on ingress\n"); infof(data, "h3_stream_recv returns on ingress");
*curlcode = CURLE_RECV_ERROR; *curlcode = CURLE_RECV_ERROR;
return -1; return -1;
} }
@ -504,7 +504,7 @@ static ssize_t h3_stream_recv(struct Curl_easy *data,
if(s != stream->stream3_id) { if(s != stream->stream3_id) {
/* another transfer, ignore for now */ /* another transfer, ignore for now */
infof(data, "Got h3 for stream %u, expects %u\n", infof(data, "Got h3 for stream %u, expects %u",
s, stream->stream3_id); s, stream->stream3_id);
continue; continue;
} }
@ -585,7 +585,7 @@ static ssize_t h3_stream_send(struct Curl_easy *data,
sent = len; sent = len;
} }
else { else {
H3BUGF(infof(data, "Pass on %zd body bytes to quiche\n", len)); H3BUGF(infof(data, "Pass on %zd body bytes to quiche", len));
sent = quiche_h3_send_body(qs->h3c, qs->conn, stream->stream3_id, sent = quiche_h3_send_body(qs->h3c, qs->conn, stream->stream3_id,
(uint8_t *)mem, len, FALSE); (uint8_t *)mem, len, FALSE);
if(sent < 0) { if(sent < 0) {
@ -778,7 +778,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
for(i = 0; i < nheader; ++i) { for(i = 0; i < nheader; ++i) {
acc += nva[i].name_len + nva[i].value_len; acc += nva[i].name_len + nva[i].value_len;
H3BUGF(infof(data, "h3 [%.*s: %.*s]\n", H3BUGF(infof(data, "h3 [%.*s: %.*s]",
nva[i].name_len, nva[i].name, nva[i].name_len, nva[i].name,
nva[i].value_len, nva[i].value)); nva[i].value_len, nva[i].value));
} }
@ -786,7 +786,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
if(acc > MAX_ACC) { if(acc > MAX_ACC) {
infof(data, "http_request: Warning: The cumulative length of all " infof(data, "http_request: Warning: The cumulative length of all "
"headers exceeds %d bytes and that could cause the " "headers exceeds %d bytes and that could cause the "
"stream to be rejected.\n", MAX_ACC); "stream to be rejected.", MAX_ACC);
} }
} }
@ -823,13 +823,13 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
Curl_safefree(nva); Curl_safefree(nva);
if(stream3_id < 0) { if(stream3_id < 0) {
H3BUGF(infof(data, "quiche_h3_send_request returned %d\n", H3BUGF(infof(data, "quiche_h3_send_request returned %d",
stream3_id)); stream3_id));
result = CURLE_SEND_ERROR; result = CURLE_SEND_ERROR;
goto fail; goto fail;
} }
infof(data, "Using HTTP/3 Stream ID: %x (easy handle %p)\n", infof(data, "Using HTTP/3 Stream ID: %x (easy handle %p)",
stream3_id, (void *)data); stream3_id, (void *)data);
stream->stream3_id = stream3_id; stream->stream3_id = stream3_id;

View File

@ -303,7 +303,7 @@ static void mystate(struct Curl_easy *data, sshstate nowstate
if(sshc->state != nowstate) { if(sshc->state != nowstate) {
infof(data, "SSH %p state change from %s to %s (line %d)\n", infof(data, "SSH %p state change from %s to %s (line %d)",
(void *) sshc, names[sshc->state], names[nowstate], (void *) sshc, names[sshc->state], names[nowstate],
lineno); lineno);
} }
@ -368,7 +368,7 @@ static int myssh_is_known(struct Curl_easy *data)
for(i = 0; i < 16; i++) for(i = 0; i < 16; i++)
msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]); msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
infof(data, "SSH MD5 fingerprint: %s\n", md5buffer); infof(data, "SSH MD5 fingerprint: %s", md5buffer);
if(!strcasecompare(md5buffer, pubkey_md5)) { if(!strcasecompare(md5buffer, pubkey_md5)) {
failf(data, failf(data,
@ -732,7 +732,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) { if(rc == SSH_AUTH_SUCCESS) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Authenticated with none\n"); infof(data, "Authenticated with none");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
break; break;
} }
@ -744,7 +744,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
sshc->auth_methods = ssh_userauth_list(sshc->ssh_session, NULL); sshc->auth_methods = ssh_userauth_list(sshc->ssh_session, NULL);
if(sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY) { if(sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY) {
state(data, SSH_AUTH_PKEY_INIT); state(data, SSH_AUTH_PKEY_INIT);
infof(data, "Authentication using SSH public key file\n"); infof(data, "Authentication using SSH public key file");
} }
else if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { else if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) {
state(data, SSH_AUTH_GSSAPI); state(data, SSH_AUTH_GSSAPI);
@ -810,7 +810,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) { if(rc == SSH_AUTH_SUCCESS) {
rc = SSH_OK; rc = SSH_OK;
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Completed public key authentication\n"); infof(data, "Completed public key authentication");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
break; break;
} }
@ -827,12 +827,12 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) { if(rc == SSH_AUTH_SUCCESS) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Completed public key authentication\n"); infof(data, "Completed public key authentication");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
break; break;
} }
else { else {
infof(data, "Failed public key authentication (rc: %d)\n", rc); infof(data, "Failed public key authentication (rc: %d)", rc);
MOVE_TO_SECONDARY_AUTH; MOVE_TO_SECONDARY_AUTH;
} }
break; break;
@ -852,7 +852,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) { if(rc == SSH_AUTH_SUCCESS) {
rc = SSH_OK; rc = SSH_OK;
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Completed gssapi authentication\n"); infof(data, "Completed gssapi authentication");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
break; break;
} }
@ -878,7 +878,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
} }
if(rc == SSH_OK) { if(rc == SSH_OK) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "completed keyboard interactive authentication\n"); infof(data, "completed keyboard interactive authentication");
} }
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
break; break;
@ -901,7 +901,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) { if(rc == SSH_AUTH_SUCCESS) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Completed password authentication\n"); infof(data, "Completed password authentication");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
} }
else { else {
@ -919,7 +919,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
/* /*
* At this point we have an authenticated ssh session. * At this point we have an authenticated ssh session.
*/ */
infof(data, "Authentication complete\n"); infof(data, "Authentication complete");
Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSH is connected */ Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSH is connected */
@ -930,7 +930,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
state(data, SSH_SFTP_INIT); state(data, SSH_SFTP_INIT);
break; break;
} }
infof(data, "SSH CONNECT phase done\n"); infof(data, "SSH CONNECT phase done");
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
@ -970,7 +970,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
we get the homedir here, we get the "workingpath" in the DO action we get the homedir here, we get the "workingpath" in the DO action
since the homedir will remain the same between request but the since the homedir will remain the same between request but the
working path will not. */ working path will not. */
DEBUGF(infof(data, "SSH CONNECT phase done\n")); DEBUGF(infof(data, "SSH CONNECT phase done"));
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
@ -983,7 +983,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
} }
if(data->set.quote) { if(data->set.quote) {
infof(data, "Sending quote commands\n"); infof(data, "Sending quote commands");
sshc->quote_item = data->set.quote; sshc->quote_item = data->set.quote;
state(data, SSH_SFTP_QUOTE); state(data, SSH_SFTP_QUOTE);
} }
@ -994,7 +994,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
case SSH_SFTP_POSTQUOTE_INIT: case SSH_SFTP_POSTQUOTE_INIT:
if(data->set.postquote) { if(data->set.postquote) {
infof(data, "Sending quote commands\n"); infof(data, "Sending quote commands");
sshc->quote_item = data->set.postquote; sshc->quote_item = data->set.postquote;
state(data, SSH_SFTP_QUOTE); state(data, SSH_SFTP_QUOTE);
} }
@ -1367,7 +1367,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(sshc->slash_pos) { if(sshc->slash_pos) {
*sshc->slash_pos = 0; *sshc->slash_pos = 0;
infof(data, "Creating directory '%s'\n", protop->path); infof(data, "Creating directory '%s'", protop->path);
state(data, SSH_SFTP_CREATE_DIRS_MKDIR); state(data, SSH_SFTP_CREATE_DIRS_MKDIR);
break; break;
} }
@ -1731,7 +1731,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(data->req.size == 0) { if(data->req.size == 0) {
/* no data to transfer */ /* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1); Curl_setup_transfer(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded\n"); infof(data, "File already completely downloaded");
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
} }
@ -1764,7 +1764,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
} }
Curl_safefree(protop->path); Curl_safefree(protop->path);
DEBUGF(infof(data, "SFTP DONE done\n")); DEBUGF(infof(data, "SFTP DONE done"));
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT /* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
After nextstate is executed, the control should come back to After nextstate is executed, the control should come back to
@ -1933,7 +1933,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
break; break;
} }
if(rc != SSH_OK) { if(rc != SSH_OK) {
infof(data, "Failed to close libssh scp channel: %s\n", infof(data, "Failed to close libssh scp channel: %s",
ssh_get_error(sshc->ssh_session)); ssh_get_error(sshc->ssh_session));
} }
} }
@ -1946,7 +1946,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
ssh_scp_free(sshc->scp_session); ssh_scp_free(sshc->scp_session);
sshc->scp_session = NULL; sshc->scp_session = NULL;
} }
DEBUGF(infof(data, "SCP DONE phase complete\n")); DEBUGF(infof(data, "SCP DONE phase complete"));
ssh_set_blocking(sshc->ssh_session, 0); ssh_set_blocking(sshc->ssh_session, 0);
@ -2213,7 +2213,7 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
} }
if(conn->user && conn->user[0] != '\0') { if(conn->user && conn->user[0] != '\0') {
infof(data, "User: %s\n", conn->user); infof(data, "User: %s", conn->user);
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_USER, conn->user); rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_USER, conn->user);
if(rc != SSH_OK) { if(rc != SSH_OK) {
failf(data, "Could not set user"); failf(data, "Could not set user");
@ -2222,7 +2222,7 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
} }
if(data->set.str[STRING_SSH_KNOWNHOSTS]) { if(data->set.str[STRING_SSH_KNOWNHOSTS]) {
infof(data, "Known hosts: %s\n", data->set.str[STRING_SSH_KNOWNHOSTS]); infof(data, "Known hosts: %s", data->set.str[STRING_SSH_KNOWNHOSTS]);
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_KNOWNHOSTS, rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_KNOWNHOSTS,
data->set.str[STRING_SSH_KNOWNHOSTS]); data->set.str[STRING_SSH_KNOWNHOSTS]);
if(rc != SSH_OK) { if(rc != SSH_OK) {
@ -2279,7 +2279,7 @@ static CURLcode scp_doing(struct Curl_easy *data, bool *dophase_done)
result = myssh_multi_statemach(data, dophase_done); result = myssh_multi_statemach(data, dophase_done);
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
} }
@ -2300,7 +2300,7 @@ CURLcode scp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */ *dophase_done = FALSE; /* not done yet */
@ -2312,7 +2312,7 @@ CURLcode scp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET]; *connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
@ -2481,7 +2481,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */ *dophase_done = FALSE; /* not done yet */
@ -2494,7 +2494,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET]; *connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
@ -2506,7 +2506,7 @@ static CURLcode sftp_doing(struct Curl_easy *data,
{ {
CURLcode result = myssh_multi_statemach(data, dophase_done); CURLcode result = myssh_multi_statemach(data, dophase_done);
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
} }
@ -2521,7 +2521,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
(void) dead_connection; (void) dead_connection;
DEBUGF(infof(data, "SSH DISCONNECT starts now\n")); DEBUGF(infof(data, "SSH DISCONNECT starts now"));
if(conn->proto.sshc.ssh_session) { if(conn->proto.sshc.ssh_session) {
/* only if there's a session still around to use! */ /* only if there's a session still around to use! */
@ -2529,7 +2529,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
result = myssh_block_statemach(data, TRUE); result = myssh_block_statemach(data, TRUE);
} }
DEBUGF(infof(data, "SSH DISCONNECT is done\n")); DEBUGF(infof(data, "SSH DISCONNECT is done"));
return result; return result;

View File

@ -378,7 +378,7 @@ static void state(struct Curl_easy *data, sshstate nowstate)
DEBUGASSERT(sizeof(names)/sizeof(names[0]) == SSH_LAST); DEBUGASSERT(sizeof(names)/sizeof(names[0]) == SSH_LAST);
if(sshc->state != nowstate) { if(sshc->state != nowstate) {
infof(data, "SFTP %p state change from %s to %s\n", infof(data, "SFTP %p state change from %s to %s",
(void *)sshc, names[sshc->state], names[nowstate]); (void *)sshc, names[sshc->state], names[nowstate]);
} }
#endif #endif
@ -491,7 +491,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
break; break;
#endif #endif
default: default:
infof(data, "unsupported key type, can't check knownhosts!\n"); infof(data, "unsupported key type, can't check knownhosts!");
keybit = 0; keybit = 0;
break; break;
} }
@ -519,7 +519,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
&host); &host);
#endif #endif
infof(data, "SSH host check: %d, key: %s\n", keycheck, infof(data, "SSH host check: %d, key: %s", keycheck,
(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)? (keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
host->key:"<none>"); host->key:"<none>");
@ -586,7 +586,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
LIBSSH2_KNOWNHOST_KEYENC_RAW| LIBSSH2_KNOWNHOST_KEYENC_RAW|
keybit, NULL); keybit, NULL);
if(addrc) if(addrc)
infof(data, "Warning adding the known host %s failed!\n", infof(data, "Warning adding the known host %s failed!",
conn->host.name); conn->host.name);
else if(rc == CURLKHSTAT_FINE_ADD_TO_FILE || else if(rc == CURLKHSTAT_FINE_ADD_TO_FILE ||
rc == CURLKHSTAT_FINE_REPLACE) { rc == CURLKHSTAT_FINE_REPLACE) {
@ -597,7 +597,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
data->set.str[STRING_SSH_KNOWNHOSTS], data->set.str[STRING_SSH_KNOWNHOSTS],
LIBSSH2_KNOWNHOST_FILE_OPENSSH); LIBSSH2_KNOWNHOST_FILE_OPENSSH);
if(wrc) { if(wrc) {
infof(data, "Warning, writing %s failed!\n", infof(data, "Warning, writing %s failed!",
data->set.str[STRING_SSH_KNOWNHOSTS]); data->set.str[STRING_SSH_KNOWNHOSTS]);
} }
} }
@ -626,7 +626,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
int i; int i;
for(i = 0; i < 16; i++) for(i = 0; i < 16; i++)
msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char) fingerprint[i]); msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char) fingerprint[i]);
infof(data, "SSH MD5 fingerprint: %s\n", md5buffer); infof(data, "SSH MD5 fingerprint: %s", md5buffer);
} }
/* Before we authenticate we check the hostkey's MD5 fingerprint /* Before we authenticate we check the hostkey's MD5 fingerprint
@ -645,7 +645,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION; sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode; return sshc->actualcode;
} }
infof(data, "MD5 checksum match!\n"); infof(data, "MD5 checksum match!");
/* as we already matched, we skip the check for known hosts */ /* as we already matched, we skip the check for known hosts */
return CURLE_OK; return CURLE_OK;
} }
@ -702,7 +702,7 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data)
if(store->name[0] == '[') { if(store->name[0] == '[') {
kh_name_end = strstr(store->name, "]:"); kh_name_end = strstr(store->name, "]:");
if(!kh_name_end) { if(!kh_name_end) {
infof(data, "Invalid host pattern %s in %s\n", infof(data, "Invalid host pattern %s in %s",
store->name, data->set.str[STRING_SSH_KNOWNHOSTS]); store->name, data->set.str[STRING_SSH_KNOWNHOSTS]);
continue; continue;
} }
@ -729,7 +729,7 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data)
} }
if(found) { if(found) {
infof(data, "Found host %s in %s\n", infof(data, "Found host %s in %s",
conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]); conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
switch(store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) { switch(store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) {
@ -768,13 +768,13 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data)
return CURLE_SSH; return CURLE_SSH;
} }
infof(data, "Set \"%s\" as SSH hostkey type\n", hostkey_method); infof(data, "Set \"%s\" as SSH hostkey type", hostkey_method);
result = libssh2_session_error_to_CURLE( result = libssh2_session_error_to_CURLE(
libssh2_session_method_pref( libssh2_session_method_pref(
sshc->ssh_session, LIBSSH2_METHOD_HOSTKEY, hostkey_method)); sshc->ssh_session, LIBSSH2_METHOD_HOSTKEY, hostkey_method));
} }
else { else {
infof(data, "Did not find host %s in %s\n", infof(data, "Did not find host %s in %s",
conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]); conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
} }
} }
@ -874,7 +874,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(!sshc->authlist) { if(!sshc->authlist) {
if(libssh2_userauth_authenticated(sshc->ssh_session)) { if(libssh2_userauth_authenticated(sshc->ssh_session)) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "SSH user accepted with no authentication\n"); infof(data, "SSH user accepted with no authentication");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
break; break;
} }
@ -887,7 +887,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
} }
break; break;
} }
infof(data, "SSH authentication methods available: %s\n", infof(data, "SSH authentication methods available: %s",
sshc->authlist); sshc->authlist);
state(data, SSH_AUTH_PKEY_INIT); state(data, SSH_AUTH_PKEY_INIT);
@ -972,8 +972,8 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
sshc->passphrase = ""; sshc->passphrase = "";
if(sshc->rsa_pub) if(sshc->rsa_pub)
infof(data, "Using SSH public key file '%s'\n", sshc->rsa_pub); infof(data, "Using SSH public key file '%s'", sshc->rsa_pub);
infof(data, "Using SSH private key file '%s'\n", sshc->rsa); infof(data, "Using SSH private key file '%s'", sshc->rsa);
state(data, SSH_AUTH_PKEY); state(data, SSH_AUTH_PKEY);
} }
@ -1000,14 +1000,14 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == 0) { if(rc == 0) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Initialized SSH public key authentication\n"); infof(data, "Initialized SSH public key authentication");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
} }
else { else {
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "SSH public key authentication failed: %s\n", err_msg); infof(data, "SSH public key authentication failed: %s", err_msg);
state(data, SSH_AUTH_PASS_INIT); state(data, SSH_AUTH_PASS_INIT);
rc = 0; /* clear rc and continue */ rc = 0; /* clear rc and continue */
} }
@ -1035,7 +1035,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
} }
if(rc == 0) { if(rc == 0) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Initialized password authentication\n"); infof(data, "Initialized password authentication");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
} }
else { else {
@ -1069,7 +1069,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(!sshc->ssh_agent) { if(!sshc->ssh_agent) {
sshc->ssh_agent = libssh2_agent_init(sshc->ssh_session); sshc->ssh_agent = libssh2_agent_init(sshc->ssh_session);
if(!sshc->ssh_agent) { if(!sshc->ssh_agent) {
infof(data, "Could not create agent object\n"); infof(data, "Could not create agent object");
state(data, SSH_AUTH_KEY_INIT); state(data, SSH_AUTH_KEY_INIT);
break; break;
@ -1080,7 +1080,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) if(rc == LIBSSH2_ERROR_EAGAIN)
break; break;
if(rc < 0) { if(rc < 0) {
infof(data, "Failure connecting to agent\n"); infof(data, "Failure connecting to agent");
state(data, SSH_AUTH_KEY_INIT); state(data, SSH_AUTH_KEY_INIT);
rc = 0; /* clear rc and continue */ rc = 0; /* clear rc and continue */
} }
@ -1100,7 +1100,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) if(rc == LIBSSH2_ERROR_EAGAIN)
break; break;
if(rc < 0) { if(rc < 0) {
infof(data, "Failure requesting identities to agent\n"); infof(data, "Failure requesting identities to agent");
state(data, SSH_AUTH_KEY_INIT); state(data, SSH_AUTH_KEY_INIT);
rc = 0; /* clear rc and continue */ rc = 0; /* clear rc and continue */
} }
@ -1136,13 +1136,13 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
} }
if(rc < 0) if(rc < 0)
infof(data, "Failure requesting identities to agent\n"); infof(data, "Failure requesting identities to agent");
else if(rc == 1) else if(rc == 1)
infof(data, "No identity would match\n"); infof(data, "No identity would match");
if(rc == LIBSSH2_ERROR_NONE) { if(rc == LIBSSH2_ERROR_NONE) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Agent based authentication successful\n"); infof(data, "Agent based authentication successful");
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
} }
else { else {
@ -1174,7 +1174,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
} }
if(rc == 0) { if(rc == 0) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Initialized keyboard interactive authentication\n"); infof(data, "Initialized keyboard interactive authentication");
} }
state(data, SSH_AUTH_DONE); state(data, SSH_AUTH_DONE);
break; break;
@ -1190,7 +1190,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
/* /*
* At this point we have an authenticated ssh session. * At this point we have an authenticated ssh session.
*/ */
infof(data, "Authentication complete\n"); infof(data, "Authentication complete");
Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSH is connected */ Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSH is connected */
@ -1201,7 +1201,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
state(data, SSH_SFTP_INIT); state(data, SSH_SFTP_INIT);
break; break;
} }
infof(data, "SSH CONNECT phase done\n"); infof(data, "SSH CONNECT phase done");
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
@ -1261,7 +1261,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
a time-out or similar */ a time-out or similar */
result = CURLE_SSH; result = CURLE_SSH;
sshc->actualcode = result; sshc->actualcode = result;
DEBUGF(infof(data, "error = %lu makes libcurl = %d\n", DEBUGF(infof(data, "error = %lu makes libcurl = %d",
sftperr, (int)result)); sftperr, (int)result));
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
@ -1271,7 +1271,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
we get the homedir here, we get the "workingpath" in the DO action we get the homedir here, we get the "workingpath" in the DO action
since the homedir will remain the same between request but the since the homedir will remain the same between request but the
working path will not. */ working path will not. */
DEBUGF(infof(data, "SSH CONNECT phase done\n")); DEBUGF(infof(data, "SSH CONNECT phase done"));
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
@ -1285,7 +1285,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
} }
if(data->set.quote) { if(data->set.quote) {
infof(data, "Sending quote commands\n"); infof(data, "Sending quote commands");
sshc->quote_item = data->set.quote; sshc->quote_item = data->set.quote;
state(data, SSH_SFTP_QUOTE); state(data, SSH_SFTP_QUOTE);
} }
@ -1296,7 +1296,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
case SSH_SFTP_POSTQUOTE_INIT: case SSH_SFTP_POSTQUOTE_INIT:
if(data->set.postquote) { if(data->set.postquote) {
infof(data, "Sending quote commands\n"); infof(data, "Sending quote commands");
sshc->quote_item = data->set.postquote; sshc->quote_item = data->set.postquote;
state(data, SSH_SFTP_QUOTE); state(data, SSH_SFTP_QUOTE);
} }
@ -2048,7 +2048,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(sshc->slash_pos) { if(sshc->slash_pos) {
*sshc->slash_pos = 0; *sshc->slash_pos = 0;
infof(data, "Creating directory '%s'\n", sshp->path); infof(data, "Creating directory '%s'", sshp->path);
state(data, SSH_SFTP_CREATE_DIRS_MKDIR); state(data, SSH_SFTP_CREATE_DIRS_MKDIR);
break; break;
} }
@ -2411,7 +2411,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(data->req.size == 0) { if(data->req.size == 0) {
/* no data to transfer */ /* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1); Curl_setup_transfer(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded\n"); infof(data, "File already completely downloaded");
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
} }
@ -2446,14 +2446,14 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to close libssh2 file: %d %s\n", rc, err_msg); infof(data, "Failed to close libssh2 file: %d %s", rc, err_msg);
} }
sshc->sftp_handle = NULL; sshc->sftp_handle = NULL;
} }
Curl_safefree(sshp->path); Curl_safefree(sshp->path);
DEBUGF(infof(data, "SFTP DONE done\n")); DEBUGF(infof(data, "SFTP DONE done"));
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT /* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
After nextstate is executed, the control should come back to After nextstate is executed, the control should come back to
@ -2483,7 +2483,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, &err_msg, (void)libssh2_session_last_error(sshc->ssh_session, &err_msg,
NULL, 0); NULL, 0);
infof(data, "Failed to close libssh2 file: %d %s\n", rc, err_msg); infof(data, "Failed to close libssh2 file: %d %s", rc, err_msg);
} }
sshc->sftp_handle = NULL; sshc->sftp_handle = NULL;
} }
@ -2493,7 +2493,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
break; break;
} }
if(rc < 0) { if(rc < 0) {
infof(data, "Failed to stop libssh2 sftp subsystem\n"); infof(data, "Failed to stop libssh2 sftp subsystem");
} }
sshc->sftp_session = NULL; sshc->sftp_session = NULL;
} }
@ -2668,7 +2668,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to send libssh2 channel EOF: %d %s\n", infof(data, "Failed to send libssh2 channel EOF: %d %s",
rc, err_msg); rc, err_msg);
} }
} }
@ -2685,7 +2685,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to get channel EOF: %d %s\n", rc, err_msg); infof(data, "Failed to get channel EOF: %d %s", rc, err_msg);
} }
} }
state(data, SSH_SCP_WAIT_CLOSE); state(data, SSH_SCP_WAIT_CLOSE);
@ -2701,7 +2701,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Channel failed to close: %d %s\n", rc, err_msg); infof(data, "Channel failed to close: %d %s", rc, err_msg);
} }
} }
state(data, SSH_SCP_CHANNEL_FREE); state(data, SSH_SCP_CHANNEL_FREE);
@ -2717,12 +2717,12 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to free libssh2 scp subsystem: %d %s\n", infof(data, "Failed to free libssh2 scp subsystem: %d %s",
rc, err_msg); rc, err_msg);
} }
sshc->ssh_channel = NULL; sshc->ssh_channel = NULL;
} }
DEBUGF(infof(data, "SCP DONE phase complete\n")); DEBUGF(infof(data, "SCP DONE phase complete"));
#if 0 /* PREV */ #if 0 /* PREV */
state(data, SSH_SESSION_DISCONNECT); state(data, SSH_SESSION_DISCONNECT);
#endif #endif
@ -2743,7 +2743,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to free libssh2 scp subsystem: %d %s\n", infof(data, "Failed to free libssh2 scp subsystem: %d %s",
rc, err_msg); rc, err_msg);
} }
sshc->ssh_channel = NULL; sshc->ssh_channel = NULL;
@ -2758,7 +2758,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to disconnect libssh2 session: %d %s\n", infof(data, "Failed to disconnect libssh2 session: %d %s",
rc, err_msg); rc, err_msg);
} }
} }
@ -2787,7 +2787,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to disconnect from libssh2 agent: %d %s\n", infof(data, "Failed to disconnect from libssh2 agent: %d %s",
rc, err_msg); rc, err_msg);
} }
libssh2_agent_free(sshc->ssh_agent); libssh2_agent_free(sshc->ssh_agent);
@ -2809,7 +2809,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL; char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
infof(data, "Failed to free libssh2 session: %d %s\n", rc, err_msg); infof(data, "Failed to free libssh2 session: %d %s", rc, err_msg);
} }
sshc->ssh_session = NULL; sshc->ssh_session = NULL;
} }
@ -3085,10 +3085,10 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
#ifdef CURL_LIBSSH2_DEBUG #ifdef CURL_LIBSSH2_DEBUG
if(conn->user) { if(conn->user) {
infof(data, "User: %s\n", conn->user); infof(data, "User: %s", conn->user);
} }
if(conn->passwd) { if(conn->passwd) {
infof(data, "Password: %s\n", conn->passwd); infof(data, "Password: %s", conn->passwd);
} }
sock = conn->sock[FIRSTSOCKET]; sock = conn->sock[FIRSTSOCKET];
#endif /* CURL_LIBSSH2_DEBUG */ #endif /* CURL_LIBSSH2_DEBUG */
@ -3122,7 +3122,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
sshrecv.recvptr = ssh_tls_recv; sshrecv.recvptr = ssh_tls_recv;
sshsend.sendptr = ssh_tls_send; sshsend.sendptr = ssh_tls_send;
infof(data, "Uses HTTPS proxy!\n"); infof(data, "Uses HTTPS proxy!");
/* /*
Setup libssh2 callbacks to make it read/write TLS from the socket. Setup libssh2 callbacks to make it read/write TLS from the socket.
@ -3160,7 +3160,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
#if LIBSSH2_VERSION_NUM >= 0x010208 #if LIBSSH2_VERSION_NUM >= 0x010208
if(libssh2_session_flag(sshc->ssh_session, LIBSSH2_FLAG_COMPRESS, 1) < 0) if(libssh2_session_flag(sshc->ssh_session, LIBSSH2_FLAG_COMPRESS, 1) < 0)
#endif #endif
infof(data, "Failed to enable compression for ssh session\n"); infof(data, "Failed to enable compression for ssh session");
} }
#ifdef HAVE_LIBSSH2_KNOWNHOST_API #ifdef HAVE_LIBSSH2_KNOWNHOST_API
@ -3178,14 +3178,14 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
data->set.str[STRING_SSH_KNOWNHOSTS], data->set.str[STRING_SSH_KNOWNHOSTS],
LIBSSH2_KNOWNHOST_FILE_OPENSSH); LIBSSH2_KNOWNHOST_FILE_OPENSSH);
if(rc < 0) if(rc < 0)
infof(data, "Failed to read known hosts from %s\n", infof(data, "Failed to read known hosts from %s",
data->set.str[STRING_SSH_KNOWNHOSTS]); data->set.str[STRING_SSH_KNOWNHOSTS]);
} }
#endif /* HAVE_LIBSSH2_KNOWNHOST_API */ #endif /* HAVE_LIBSSH2_KNOWNHOST_API */
#ifdef CURL_LIBSSH2_DEBUG #ifdef CURL_LIBSSH2_DEBUG
libssh2_trace(sshc->ssh_session, ~0); libssh2_trace(sshc->ssh_session, ~0);
infof(data, "SSH socket: %d\n", (int)sock); infof(data, "SSH socket: %d", (int)sock);
#endif /* CURL_LIBSSH2_DEBUG */ #endif /* CURL_LIBSSH2_DEBUG */
state(data, SSH_INIT); state(data, SSH_INIT);
@ -3212,7 +3212,7 @@ CURLcode scp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */ *dophase_done = FALSE; /* not done yet */
@ -3225,7 +3225,7 @@ CURLcode scp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET]; *connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
@ -3239,7 +3239,7 @@ static CURLcode scp_doing(struct Curl_easy *data,
result = ssh_multi_statemach(data, dophase_done); result = ssh_multi_statemach(data, dophase_done);
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
} }
@ -3401,7 +3401,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */ *dophase_done = FALSE; /* not done yet */
@ -3414,7 +3414,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
*connected = data->conn->bits.tcpconnect[FIRSTSOCKET]; *connected = data->conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
@ -3427,7 +3427,7 @@ static CURLcode sftp_doing(struct Curl_easy *data,
CURLcode result = ssh_multi_statemach(data, dophase_done); CURLcode result = ssh_multi_statemach(data, dophase_done);
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
} }
@ -3442,7 +3442,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
struct ssh_conn *sshc = &conn->proto.sshc; struct ssh_conn *sshc = &conn->proto.sshc;
(void) dead_connection; (void) dead_connection;
DEBUGF(infof(data, "SSH DISCONNECT starts now\n")); DEBUGF(infof(data, "SSH DISCONNECT starts now"));
if(sshc->ssh_session) { if(sshc->ssh_session) {
/* only if there's a session still around to use! */ /* only if there's a session still around to use! */
@ -3450,7 +3450,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
result = ssh_block_statemach(data, conn, TRUE); result = ssh_block_statemach(data, conn, TRUE);
} }
DEBUGF(infof(data, "SSH DISCONNECT is done\n")); DEBUGF(infof(data, "SSH DISCONNECT is done"));
return result; return result;

View File

@ -205,7 +205,7 @@ static void state(struct Curl_easy *data, sshstate nowstate)
DEBUGASSERT(sizeof(names)/sizeof(names[0]) == SSH_LAST); DEBUGASSERT(sizeof(names)/sizeof(names[0]) == SSH_LAST);
if(sshc->state != nowstate) { if(sshc->state != nowstate) {
infof(data, "wolfssh %p state change from %s to %s\n", infof(data, "wolfssh %p state change from %s to %s",
(void *)sshc, names[sshc->state], names[nowstate]); (void *)sshc, names[sshc->state], names[nowstate]);
} }
#endif #endif
@ -274,7 +274,7 @@ static ssize_t wsftp_send(struct Curl_easy *data, int sockindex,
return -1; return -1;
} }
DEBUGASSERT(rc == (int)len); DEBUGASSERT(rc == (int)len);
infof(data, "sent %zd bytes SFTP from offset %zd\n", infof(data, "sent %zd bytes SFTP from offset %zd",
len, sshc->offset); len, sshc->offset);
sshc->offset += len; sshc->offset += len;
return (ssize_t)rc; return (ssize_t)rc;
@ -348,7 +348,7 @@ static int userauth(byte authtype,
void *ctx) void *ctx)
{ {
struct Curl_easy *data = ctx; struct Curl_easy *data = ctx;
DEBUGF(infof(data, "wolfssh callback: type %s\n", DEBUGF(infof(data, "wolfssh callback: type %s",
authtype == WOLFSSH_USERAUTH_PASSWORD ? "PASSWORD" : authtype == WOLFSSH_USERAUTH_PASSWORD ? "PASSWORD" :
"PUBLICCKEY")); "PUBLICCKEY"));
if(authtype == WOLFSSH_USERAUTH_PASSWORD) { if(authtype == WOLFSSH_USERAUTH_PASSWORD) {
@ -468,7 +468,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
state(data, SSH_STOP); state(data, SSH_STOP);
return CURLE_SSH; return CURLE_SSH;
} }
infof(data, "wolfssh connected!\n"); infof(data, "wolfssh connected!");
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
case SSH_STOP: case SSH_STOP:
@ -489,7 +489,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK; return CURLE_OK;
} }
else if(rc == WS_SUCCESS) { else if(rc == WS_SUCCESS) {
infof(data, "wolfssh SFTP connected!\n"); infof(data, "wolfssh SFTP connected!");
state(data, SSH_SFTP_REALPATH); state(data, SSH_SFTP_REALPATH);
} }
else { else {
@ -518,7 +518,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
else { else {
memcpy(sshc->homedir, name->fName, name->fSz); memcpy(sshc->homedir, name->fName, name->fSz);
sshc->homedir[name->fSz] = 0; sshc->homedir[name->fSz] = 0;
infof(data, "wolfssh SFTP realpath succeeded!\n"); infof(data, "wolfssh SFTP realpath succeeded!");
} }
wolfSSH_SFTPNAME_list_free(name); wolfSSH_SFTPNAME_list_free(name);
state(data, SSH_STOP); state(data, SSH_STOP);
@ -536,7 +536,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
} }
if(data->set.quote) { if(data->set.quote) {
infof(data, "Sending quote commands\n"); infof(data, "Sending quote commands");
sshc->quote_item = data->set.quote; sshc->quote_item = data->set.quote;
state(data, SSH_SFTP_QUOTE); state(data, SSH_SFTP_QUOTE);
} }
@ -616,7 +616,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK; return CURLE_OK;
} }
else if(rc == WS_SUCCESS) { else if(rc == WS_SUCCESS) {
infof(data, "wolfssh SFTP open succeeded!\n"); infof(data, "wolfssh SFTP open succeeded!");
} }
else { else {
failf(data, "wolfssh SFTP upload open failed: %d", rc); failf(data, "wolfssh SFTP upload open failed: %d", rc);
@ -727,7 +727,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK; return CURLE_OK;
} }
else if(rc == WS_SUCCESS) { else if(rc == WS_SUCCESS) {
infof(data, "wolfssh SFTP open succeeded!\n"); infof(data, "wolfssh SFTP open succeeded!");
state(data, SSH_SFTP_DOWNLOAD_STAT); state(data, SSH_SFTP_DOWNLOAD_STAT);
return CURLE_OK; return CURLE_OK;
} }
@ -753,7 +753,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK; return CURLE_OK;
} }
else if(rc == WS_SUCCESS) { else if(rc == WS_SUCCESS) {
infof(data, "wolfssh STAT succeeded!\n"); infof(data, "wolfssh STAT succeeded!");
} }
else { else {
failf(data, "wolfssh SFTP open failed: %d", rc); failf(data, "wolfssh SFTP open failed: %d", rc);
@ -769,12 +769,12 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
data->req.maxdownload = size; data->req.maxdownload = size;
Curl_pgrsSetDownloadSize(data, size); Curl_pgrsSetDownloadSize(data, size);
infof(data, "SFTP download %" CURL_FORMAT_CURL_OFF_T " bytes\n", size); infof(data, "SFTP download %" CURL_FORMAT_CURL_OFF_T " bytes", size);
/* We cannot seek with wolfSSH so resuming and range requests are not /* We cannot seek with wolfSSH so resuming and range requests are not
possible */ possible */
if(data->state.use_range || data->state.resume_from) { if(data->state.use_range || data->state.resume_from) {
infof(data, "wolfSSH cannot do range/seek on SFTP\n"); infof(data, "wolfSSH cannot do range/seek on SFTP");
return CURLE_BAD_DOWNLOAD_RESUME; return CURLE_BAD_DOWNLOAD_RESUME;
} }
@ -782,7 +782,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
if(data->req.size == 0) { if(data->req.size == 0) {
/* no data to transfer */ /* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1); Curl_setup_transfer(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded\n"); infof(data, "File already completely downloaded");
state(data, SSH_STOP); state(data, SSH_STOP);
break; break;
} }
@ -911,7 +911,7 @@ static CURLcode wssh_multi_statemach(struct Curl_easy *data, bool *done)
/* if there's no error, it isn't done and it didn't EWOULDBLOCK, then /* if there's no error, it isn't done and it didn't EWOULDBLOCK, then
try again */ try again */
if(*done) { if(*done) {
DEBUGF(infof(data, "wssh_statemach_act says DONE\n")); DEBUGF(infof(data, "wssh_statemach_act says DONE"));
} }
} while(!result && !*done && !block); } while(!result && !*done && !block);
@ -937,7 +937,7 @@ CURLcode wsftp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n")); DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */ *dophase_done = FALSE; /* not done yet */
@ -950,7 +950,7 @@ CURLcode wsftp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET]; *connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
@ -1107,7 +1107,7 @@ static CURLcode wsftp_doing(struct Curl_easy *data,
CURLcode result = wssh_multi_statemach(data, dophase_done); CURLcode result = wssh_multi_statemach(data, dophase_done);
if(*dophase_done) { if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n")); DEBUGF(infof(data, "DO phase is complete"));
} }
return result; return result;
} }
@ -1119,7 +1119,7 @@ static CURLcode wsftp_disconnect(struct Curl_easy *data,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
(void)dead; (void)dead;
DEBUGF(infof(data, "SSH DISCONNECT starts now\n")); DEBUGF(infof(data, "SSH DISCONNECT starts now"));
if(conn->proto.sshc.ssh_session) { if(conn->proto.sshc.ssh_session) {
/* only if there's a session still around to use! */ /* only if there's a session still around to use! */
@ -1127,7 +1127,7 @@ static CURLcode wsftp_disconnect(struct Curl_easy *data,
result = wssh_block_statemach(data, TRUE); result = wssh_block_statemach(data, TRUE);
} }
DEBUGF(infof(data, "SSH DISCONNECT is done\n")); DEBUGF(infof(data, "SSH DISCONNECT is done"));
return result; return result;
} }

View File

@ -349,7 +349,7 @@ static CURLcode bearssl_connect_step1(struct Curl_easy *data,
return ret; return ret;
} }
infof(data, "error setting certificate verify locations," infof(data, "error setting certificate verify locations,"
" continuing anyway:\n"); " continuing anyway:");
} }
} }
@ -373,7 +373,7 @@ static CURLcode bearssl_connect_step1(struct Curl_easy *data,
if(!Curl_ssl_getsessionid(data, conn, SSL_IS_PROXY() ? TRUE : FALSE, if(!Curl_ssl_getsessionid(data, conn, SSL_IS_PROXY() ? TRUE : FALSE,
&session, NULL, sockindex)) { &session, NULL, sockindex)) {
br_ssl_engine_set_session_parameters(&backend->ctx.eng, session); br_ssl_engine_set_session_parameters(&backend->ctx.eng, session);
infof(data, "BearSSL: re-using session ID\n"); infof(data, "BearSSL: re-using session ID");
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
} }
@ -392,12 +392,12 @@ static CURLcode bearssl_connect_step1(struct Curl_easy *data,
#endif #endif
) { ) {
backend->protocols[cur++] = ALPN_H2; backend->protocols[cur++] = ALPN_H2;
infof(data, "ALPN, offering %s\n", ALPN_H2); infof(data, "ALPN, offering %s", ALPN_H2);
} }
#endif #endif
backend->protocols[cur++] = ALPN_HTTP_1_1; backend->protocols[cur++] = ALPN_HTTP_1_1;
infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1); infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
br_ssl_engine_set_protocol_names(&backend->ctx.eng, br_ssl_engine_set_protocol_names(&backend->ctx.eng,
backend->protocols, cur); backend->protocols, cur);
@ -538,7 +538,7 @@ static CURLcode bearssl_connect_step3(struct Curl_easy *data,
protocol = br_ssl_engine_get_selected_protocol(&backend->ctx.eng); protocol = br_ssl_engine_get_selected_protocol(&backend->ctx.eng);
if(protocol) { if(protocol) {
infof(data, "ALPN, server accepted to use %s\n", protocol); infof(data, "ALPN, server accepted to use %s", protocol);
#ifdef USE_HTTP2 #ifdef USE_HTTP2
if(!strcmp(protocol, ALPN_H2)) if(!strcmp(protocol, ALPN_H2))
@ -548,12 +548,12 @@ static CURLcode bearssl_connect_step3(struct Curl_easy *data,
if(!strcmp(protocol, ALPN_HTTP_1_1)) if(!strcmp(protocol, ALPN_HTTP_1_1))
conn->negnpn = CURL_HTTP_VERSION_1_1; conn->negnpn = CURL_HTTP_VERSION_1_1;
else else
infof(data, "ALPN, unrecognized protocol %s\n", protocol); infof(data, "ALPN, unrecognized protocol %s", protocol);
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE); BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
} }
else else
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
} }
if(SSL_SET_OPTION(primary.sessionid)) { if(SSL_SET_OPTION(primary.sessionid)) {

View File

@ -1011,7 +1011,7 @@ static CURLcode gskit_connect_step3(struct Curl_easy *data,
CURLE_OK) { CURLE_OK) {
int i; int i;
infof(data, "Server certificate:\n"); infof(data, "Server certificate:");
p = cdev; p = cdev;
for(i = 0; i++ < cdec; p++) for(i = 0; i++ < cdec; p++)
switch(p->cert_data_id) { switch(p->cert_data_id) {
@ -1020,16 +1020,16 @@ static CURLcode gskit_connect_step3(struct Curl_easy *data,
certend = cert + cdev->cert_data_l; certend = cert + cdev->cert_data_l;
break; break;
case CERT_DN_PRINTABLE: case CERT_DN_PRINTABLE:
infof(data, "\t subject: %.*s\n", p->cert_data_l, p->cert_data_p); infof(data, "\t subject: %.*s", p->cert_data_l, p->cert_data_p);
break; break;
case CERT_ISSUER_DN_PRINTABLE: case CERT_ISSUER_DN_PRINTABLE:
infof(data, "\t issuer: %.*s\n", p->cert_data_l, p->cert_data_p); infof(data, "\t issuer: %.*s", p->cert_data_l, p->cert_data_p);
break; break;
case CERT_VALID_FROM: case CERT_VALID_FROM:
infof(data, "\t start date: %.*s\n", p->cert_data_l, p->cert_data_p); infof(data, "\t start date: %.*s", p->cert_data_l, p->cert_data_p);
break; break;
case CERT_VALID_TO: case CERT_VALID_TO:
infof(data, "\t expire date: %.*s\n", p->cert_data_l, p->cert_data_p); infof(data, "\t expire date: %.*s", p->cert_data_l, p->cert_data_p);
break; break;
} }
} }

View File

@ -147,7 +147,7 @@ static void showtime(struct Curl_easy *data,
msnprintf(str, msnprintf(str,
sizeof(str), sizeof(str),
"\t %s: %s, %02d %s %4d %02d:%02d:%02d GMT", " %s: %s, %02d %s %4d %02d:%02d:%02d GMT",
text, text,
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
tm->tm_mday, tm->tm_mday,
@ -156,7 +156,7 @@ static void showtime(struct Curl_easy *data,
tm->tm_hour, tm->tm_hour,
tm->tm_min, tm->tm_min,
tm->tm_sec); tm->tm_sec);
infof(data, "%s\n", str); infof(data, "%s", str);
} }
#endif #endif
@ -266,7 +266,7 @@ static CURLcode handshake(struct Curl_easy *data,
if(!strerr) if(!strerr)
strerr = gnutls_strerror(rc); strerr = gnutls_strerror(rc);
infof(data, "gnutls_handshake() warning: %s\n", strerr); infof(data, "gnutls_handshake() warning: %s", strerr);
continue; continue;
} }
else if(rc < 0) { else if(rc < 0) {
@ -432,7 +432,7 @@ gtls_connect_step1(struct Curl_easy *data,
#ifdef HAVE_GNUTLS_SRP #ifdef HAVE_GNUTLS_SRP
if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) { if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username)); infof(data, "Using TLS-SRP username: %s", SSL_SET_OPTION(username));
rc = gnutls_srp_allocate_client_credentials( rc = gnutls_srp_allocate_client_credentials(
&backend->srp_client_cred); &backend->srp_client_cred);
@ -462,7 +462,7 @@ gtls_connect_step1(struct Curl_easy *data,
SSL_CONN_CONFIG(CAfile), SSL_CONN_CONFIG(CAfile),
GNUTLS_X509_FMT_PEM); GNUTLS_X509_FMT_PEM);
if(rc < 0) { if(rc < 0) {
infof(data, "error reading ca cert file %s (%s)\n", infof(data, "error reading ca cert file %s (%s)",
SSL_CONN_CONFIG(CAfile), gnutls_strerror(rc)); SSL_CONN_CONFIG(CAfile), gnutls_strerror(rc));
if(SSL_CONN_CONFIG(verifypeer)) { if(SSL_CONN_CONFIG(verifypeer)) {
*certverifyresult = rc; *certverifyresult = rc;
@ -470,7 +470,7 @@ gtls_connect_step1(struct Curl_easy *data,
} }
} }
else else
infof(data, "found %d certificates in %s\n", rc, infof(data, "found %d certificates in %s", rc,
SSL_CONN_CONFIG(CAfile)); SSL_CONN_CONFIG(CAfile));
} }
@ -480,7 +480,7 @@ gtls_connect_step1(struct Curl_easy *data,
SSL_CONN_CONFIG(CApath), SSL_CONN_CONFIG(CApath),
GNUTLS_X509_FMT_PEM); GNUTLS_X509_FMT_PEM);
if(rc < 0) { if(rc < 0) {
infof(data, "error reading ca cert file %s (%s)\n", infof(data, "error reading ca cert file %s (%s)",
SSL_CONN_CONFIG(CApath), gnutls_strerror(rc)); SSL_CONN_CONFIG(CApath), gnutls_strerror(rc));
if(SSL_CONN_CONFIG(verifypeer)) { if(SSL_CONN_CONFIG(verifypeer)) {
*certverifyresult = rc; *certverifyresult = rc;
@ -488,7 +488,7 @@ gtls_connect_step1(struct Curl_easy *data,
} }
} }
else else
infof(data, "found %d certificates in %s\n", infof(data, "found %d certificates in %s",
rc, SSL_CONN_CONFIG(CApath)); rc, SSL_CONN_CONFIG(CApath));
} }
@ -511,7 +511,7 @@ gtls_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CRL_BADFILE; return CURLE_SSL_CRL_BADFILE;
} }
else else
infof(data, "found %d CRL in %s\n", infof(data, "found %d CRL in %s",
rc, SSL_SET_OPTION(CRLfile)); rc, SSL_SET_OPTION(CRLfile));
} }
@ -544,7 +544,7 @@ gtls_connect_step1(struct Curl_easy *data,
(gnutls_server_name_set(session, GNUTLS_NAME_DNS, hostname, (gnutls_server_name_set(session, GNUTLS_NAME_DNS, hostname,
strlen(hostname)) < 0)) strlen(hostname)) < 0))
infof(data, "WARNING: failed to configure server name indication (SNI) " infof(data, "WARNING: failed to configure server name indication (SNI) "
"TLS extension\n"); "TLS extension");
/* Use default priorities */ /* Use default priorities */
rc = gnutls_set_default_priority(session); rc = gnutls_set_default_priority(session);
@ -597,12 +597,12 @@ gtls_connect_step1(struct Curl_easy *data,
free(prioritysrp); free(prioritysrp);
if((rc == GNUTLS_E_INVALID_REQUEST) && err) { if((rc == GNUTLS_E_INVALID_REQUEST) && err) {
infof(data, "This GnuTLS does not support SRP\n"); infof(data, "This GnuTLS does not support SRP");
} }
} }
else { else {
#endif #endif
infof(data, "GnuTLS ciphers: %s\n", prioritylist); infof(data, "GnuTLS ciphers: %s", prioritylist);
rc = gnutls_priority_set_direct(session, prioritylist, &err); rc = gnutls_priority_set_direct(session, prioritylist, &err);
#ifdef HAVE_GNUTLS_SRP #ifdef HAVE_GNUTLS_SRP
} }
@ -627,14 +627,14 @@ gtls_connect_step1(struct Curl_easy *data,
protocols[cur].data = (unsigned char *)ALPN_H2; protocols[cur].data = (unsigned char *)ALPN_H2;
protocols[cur].size = ALPN_H2_LENGTH; protocols[cur].size = ALPN_H2_LENGTH;
cur++; cur++;
infof(data, "ALPN, offering %.*s\n", ALPN_H2_LENGTH, ALPN_H2); infof(data, "ALPN, offering %.*s", ALPN_H2_LENGTH, ALPN_H2);
} }
#endif #endif
protocols[cur].data = (unsigned char *)ALPN_HTTP_1_1; protocols[cur].data = (unsigned char *)ALPN_HTTP_1_1;
protocols[cur].size = ALPN_HTTP_1_1_LENGTH; protocols[cur].size = ALPN_HTTP_1_1_LENGTH;
cur++; cur++;
infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1); infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
gnutls_alpn_set_protocols(session, protocols, cur, 0); gnutls_alpn_set_protocols(session, protocols, cur, 0);
} }
@ -740,7 +740,7 @@ gtls_connect_step1(struct Curl_easy *data,
gnutls_session_set_data(session, ssl_sessionid, ssl_idsize); gnutls_session_set_data(session, ssl_sessionid, ssl_idsize);
/* Informational message */ /* Informational message */
infof(data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID");
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
} }
@ -843,7 +843,7 @@ gtls_connect_step3(struct Curl_easy *data,
gnutls_cipher_get(session), gnutls_cipher_get(session),
gnutls_mac_get(session)); gnutls_mac_get(session));
infof(data, "SSL connection using %s / %s\n", infof(data, "SSL connection using %s / %s",
gnutls_protocol_get_name(version), ptr); gnutls_protocol_get_name(version), ptr);
/* This function will return the peer's raw certificate (chain) as sent by /* This function will return the peer's raw certificate (chain) as sent by
@ -874,7 +874,7 @@ gtls_connect_step3(struct Curl_easy *data,
} }
#endif #endif
} }
infof(data, "\t common name: WARNING couldn't obtain\n"); infof(data, " common name: WARNING couldn't obtain");
} }
if(data->set.ssl.certinfo && chainp) { if(data->set.ssl.certinfo && chainp) {
@ -921,13 +921,13 @@ gtls_connect_step3(struct Curl_easy *data,
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
else else
infof(data, "\t server certificate verification FAILED\n"); infof(data, " server certificate verification FAILED");
} }
else else
infof(data, "\t server certificate verification OK\n"); infof(data, " server certificate verification OK");
} }
else else
infof(data, "\t server certificate verification SKIPPED\n"); infof(data, " server certificate verification SKIPPED");
if(SSL_CONN_CONFIG(verifystatus)) { if(SSL_CONN_CONFIG(verifystatus)) {
if(gnutls_ocsp_status_request_is_checked(session, 0) == 0) { if(gnutls_ocsp_status_request_is_checked(session, 0) == 0) {
@ -939,7 +939,7 @@ gtls_connect_step3(struct Curl_easy *data,
rc = gnutls_ocsp_status_request_get(session, &status_request); rc = gnutls_ocsp_status_request_get(session, &status_request);
infof(data, "\t server certificate status verification FAILED\n"); infof(data, " server certificate status verification FAILED");
if(rc == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { if(rc == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
failf(data, "No OCSP response received"); failf(data, "No OCSP response received");
@ -1027,10 +1027,10 @@ gtls_connect_step3(struct Curl_easy *data,
return CURLE_SSL_INVALIDCERTSTATUS; return CURLE_SSL_INVALIDCERTSTATUS;
} }
else else
infof(data, "\t server certificate status verification OK\n"); infof(data, " server certificate status verification OK");
} }
else else
infof(data, "\t server certificate status verification SKIPPED\n"); infof(data, " server certificate status verification SKIPPED");
/* initialize an X.509 certificate structure. */ /* initialize an X.509 certificate structure. */
gnutls_x509_crt_init(&x509_cert); gnutls_x509_crt_init(&x509_cert);
@ -1053,7 +1053,7 @@ gtls_connect_step3(struct Curl_easy *data,
gnutls_x509_crt_deinit(x509_cert); gnutls_x509_crt_deinit(x509_cert);
return CURLE_SSL_ISSUER_ERROR; return CURLE_SSL_ISSUER_ERROR;
} }
infof(data, "\t server certificate issuer check OK (Issuer Cert: %s)\n", infof(data, " server certificate issuer check OK (Issuer Cert: %s)",
SSL_SET_OPTION(issuercert)?SSL_SET_OPTION(issuercert):"none"); SSL_SET_OPTION(issuercert)?SSL_SET_OPTION(issuercert):"none");
} }
@ -1064,7 +1064,7 @@ gtls_connect_step3(struct Curl_easy *data,
certname, certname,
&size); &size);
if(rc) { if(rc) {
infof(data, "error fetching CN from cert:%s\n", infof(data, "error fetching CN from cert:%s",
gnutls_strerror(rc)); gnutls_strerror(rc));
} }
@ -1124,11 +1124,11 @@ gtls_connect_step3(struct Curl_easy *data,
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
else else
infof(data, "\t common name: %s (does not match '%s')\n", infof(data, " common name: %s (does not match '%s')",
certname, SSL_HOST_DISPNAME()); certname, SSL_HOST_DISPNAME());
} }
else else
infof(data, "\t common name: %s (matched)\n", certname); infof(data, " common name: %s (matched)", certname);
/* Check for time-based validity */ /* Check for time-based validity */
certclock = gnutls_x509_crt_get_expiration_time(x509_cert); certclock = gnutls_x509_crt_get_expiration_time(x509_cert);
@ -1141,7 +1141,7 @@ gtls_connect_step3(struct Curl_easy *data,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
else else
infof(data, "\t server certificate expiration date verify FAILED\n"); infof(data, " server certificate expiration date verify FAILED");
} }
else { else {
if(certclock < time(NULL)) { if(certclock < time(NULL)) {
@ -1152,10 +1152,10 @@ gtls_connect_step3(struct Curl_easy *data,
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
else else
infof(data, "\t server certificate expiration date FAILED\n"); infof(data, " server certificate expiration date FAILED");
} }
else else
infof(data, "\t server certificate expiration date OK\n"); infof(data, " server certificate expiration date OK");
} }
certclock = gnutls_x509_crt_get_activation_time(x509_cert); certclock = gnutls_x509_crt_get_activation_time(x509_cert);
@ -1168,7 +1168,7 @@ gtls_connect_step3(struct Curl_easy *data,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
else else
infof(data, "\t server certificate activation date verify FAILED\n"); infof(data, " server certificate activation date verify FAILED");
} }
else { else {
if(certclock > time(NULL)) { if(certclock > time(NULL)) {
@ -1179,10 +1179,10 @@ gtls_connect_step3(struct Curl_easy *data,
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
else else
infof(data, "\t server certificate activation date FAILED\n"); infof(data, " server certificate activation date FAILED");
} }
else else
infof(data, "\t server certificate activation date OK\n"); infof(data, " server certificate activation date OK");
} }
ptr = SSL_PINNED_PUB_KEY(); ptr = SSL_PINNED_PUB_KEY();
@ -1208,19 +1208,19 @@ gtls_connect_step3(struct Curl_easy *data,
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
/* public key algorithm's parameters */ /* public key algorithm's parameters */
algo = gnutls_x509_crt_get_pk_algorithm(x509_cert, &bits); algo = gnutls_x509_crt_get_pk_algorithm(x509_cert, &bits);
infof(data, "\t certificate public key: %s\n", infof(data, " certificate public key: %s",
gnutls_pk_algorithm_get_name(algo)); gnutls_pk_algorithm_get_name(algo));
/* version of the X.509 certificate. */ /* version of the X.509 certificate. */
infof(data, "\t certificate version: #%d\n", infof(data, " certificate version: #%d",
gnutls_x509_crt_get_version(x509_cert)); gnutls_x509_crt_get_version(x509_cert));
rc = gnutls_x509_crt_get_dn2(x509_cert, &certfields); rc = gnutls_x509_crt_get_dn2(x509_cert, &certfields);
if(rc) if(rc)
infof(data, "Failed to get certificate name\n"); infof(data, "Failed to get certificate name");
else { else {
infof(data, "\t subject: %s\n", certfields.data); infof(data, " subject: %s", certfields.data);
certclock = gnutls_x509_crt_get_activation_time(x509_cert); certclock = gnutls_x509_crt_get_activation_time(x509_cert);
showtime(data, "start date", certclock); showtime(data, "start date", certclock);
@ -1233,9 +1233,9 @@ gtls_connect_step3(struct Curl_easy *data,
rc = gnutls_x509_crt_get_issuer_dn2(x509_cert, &certfields); rc = gnutls_x509_crt_get_issuer_dn2(x509_cert, &certfields);
if(rc) if(rc)
infof(data, "Failed to get certificate issuer\n"); infof(data, "Failed to get certificate issuer");
else { else {
infof(data, "\t issuer: %s\n", certfields.data); infof(data, " issuer: %s", certfields.data);
gnutls_free(certfields.data); gnutls_free(certfields.data);
} }
@ -1246,7 +1246,7 @@ gtls_connect_step3(struct Curl_easy *data,
if(conn->bits.tls_enable_alpn) { if(conn->bits.tls_enable_alpn) {
rc = gnutls_alpn_get_selected_protocol(session, &proto); rc = gnutls_alpn_get_selected_protocol(session, &proto);
if(rc == 0) { if(rc == 0) {
infof(data, "ALPN, server accepted to use %.*s\n", proto.size, infof(data, "ALPN, server accepted to use %.*s", proto.size,
proto.data); proto.data);
#ifdef USE_HTTP2 #ifdef USE_HTTP2
@ -1263,7 +1263,7 @@ gtls_connect_step3(struct Curl_easy *data,
} }
} }
else else
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE); BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
@ -1505,7 +1505,7 @@ static int gtls_shutdown(struct Curl_easy *data, struct connectdata *conn,
break; break;
case GNUTLS_E_AGAIN: case GNUTLS_E_AGAIN:
case GNUTLS_E_INTERRUPTED: case GNUTLS_E_INTERRUPTED:
infof(data, "GNUTLS_E_AGAIN || GNUTLS_E_INTERRUPTED\n"); infof(data, "GNUTLS_E_AGAIN || GNUTLS_E_INTERRUPTED");
break; break;
default: default:
retval = -1; retval = -1;
@ -1619,7 +1619,7 @@ static bool gtls_cert_status_request(void)
} }
static void *gtls_get_internals(struct ssl_connect_data *connssl, static void *gtls_get_internals(struct ssl_connect_data *connssl,
CURLINFO info UNUSED_PARAM) CURLINFO info UNUSED_PARAM)
{ {
struct ssl_backend_data *backend = connssl->backend; struct ssl_backend_data *backend = connssl->backend;
(void)info; (void)info;

View File

@ -401,7 +401,7 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn,
} }
} }
infof(data, "mbedTLS: Connecting to %s:%ld\n", hostname, port); infof(data, "mbedTLS: Connecting to %s:%ld", hostname, port);
mbedtls_ssl_config_init(&backend->config); mbedtls_ssl_config_init(&backend->config);
@ -428,7 +428,7 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn,
case CURL_SSLVERSION_TLSv1: case CURL_SSLVERSION_TLSv1:
mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3, mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
MBEDTLS_SSL_MINOR_VERSION_1); MBEDTLS_SSL_MINOR_VERSION_1);
infof(data, "mbedTLS: Set min SSL version to TLS 1.0\n"); infof(data, "mbedTLS: Set min SSL version to TLS 1.0");
break; break;
case CURL_SSLVERSION_TLSv1_0: case CURL_SSLVERSION_TLSv1_0:
case CURL_SSLVERSION_TLSv1_1: case CURL_SSLVERSION_TLSv1_1:
@ -481,7 +481,7 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn,
failf(data, "mbedtls_ssl_set_session returned -0x%x", -ret); failf(data, "mbedtls_ssl_set_session returned -0x%x", -ret);
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
infof(data, "mbedTLS re-using session\n"); infof(data, "mbedTLS re-using session");
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
} }
@ -519,7 +519,7 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
for(p = &backend->protocols[0]; *p; ++p) for(p = &backend->protocols[0]; *p; ++p)
infof(data, "ALPN, offering %s\n", *p); infof(data, "ALPN, offering %s", *p);
} }
#endif #endif
@ -581,9 +581,8 @@ mbed_connect_step2(struct Curl_easy *data, struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
infof(data, "mbedTLS: Handshake complete, cipher is %s\n", infof(data, "mbedTLS: Handshake complete, cipher is %s",
mbedtls_ssl_get_ciphersuite(&backend->ssl) mbedtls_ssl_get_ciphersuite(&backend->ssl));
);
ret = mbedtls_ssl_get_verify_result(&backend->ssl); ret = mbedtls_ssl_get_verify_result(&backend->ssl);
@ -620,9 +619,9 @@ mbed_connect_step2(struct Curl_easy *data, struct connectdata *conn,
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
if(mbedtls_x509_crt_info(buffer, bufsize, "* ", peercert) > 0) if(mbedtls_x509_crt_info(buffer, bufsize, "* ", peercert) > 0)
infof(data, "Dumping cert info:\n%s\n", buffer); infof(data, "Dumping cert info: %s", buffer);
else else
infof(data, "Unable to dump certificate information.\n"); infof(data, "Unable to dump certificate information");
free(buffer); free(buffer);
} }
@ -683,7 +682,7 @@ mbed_connect_step2(struct Curl_easy *data, struct connectdata *conn,
const char *next_protocol = mbedtls_ssl_get_alpn_protocol(&backend->ssl); const char *next_protocol = mbedtls_ssl_get_alpn_protocol(&backend->ssl);
if(next_protocol) { if(next_protocol) {
infof(data, "ALPN, server accepted to use %s\n", next_protocol); infof(data, "ALPN, server accepted to use %s", next_protocol);
#ifdef USE_NGHTTP2 #ifdef USE_NGHTTP2
if(!strncmp(next_protocol, NGHTTP2_PROTO_VERSION_ID, if(!strncmp(next_protocol, NGHTTP2_PROTO_VERSION_ID,
NGHTTP2_PROTO_VERSION_ID_LEN) && NGHTTP2_PROTO_VERSION_ID_LEN) &&
@ -698,7 +697,7 @@ mbed_connect_step2(struct Curl_easy *data, struct connectdata *conn,
} }
} }
else { else {
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
} }
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE); BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
@ -706,7 +705,7 @@ mbed_connect_step2(struct Curl_easy *data, struct connectdata *conn,
#endif #endif
connssl->connecting_state = ssl_connect_3; connssl->connecting_state = ssl_connect_3;
infof(data, "SSL connected\n"); infof(data, "SSL connected");
return CURLE_OK; return CURLE_OK;
} }

View File

@ -167,14 +167,14 @@ mesalink_connect_step1(struct Curl_easy *data,
} }
infof(data, infof(data,
"error setting certificate verify locations," "error setting certificate verify locations,"
" continuing anyway:\n"); " continuing anyway:");
} }
else { else {
infof(data, "successfully set certificate verify locations:\n"); infof(data, "successfully set certificate verify locations:");
} }
infof(data, " CAfile: %s\n", infof(data, " CAfile: %s",
SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile): "none"); SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile): "none");
infof(data, " CApath: %s\n", infof(data, " CApath: %s",
SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath): "none"); SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath): "none");
} }
@ -196,7 +196,7 @@ mesalink_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
infof(data, infof(data,
"client cert: %s\n", "client cert: %s",
SSL_CONN_CONFIG(clientcert)? SSL_CONN_CONFIG(clientcert)?
SSL_CONN_CONFIG(clientcert): "none"); SSL_CONN_CONFIG(clientcert): "none");
} }
@ -209,7 +209,7 @@ mesalink_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CIPHER; return CURLE_SSL_CIPHER;
} }
#endif #endif
infof(data, "Cipher selection: %s\n", ciphers); infof(data, "Cipher selection: %s", ciphers);
} }
if(BACKEND->handle) if(BACKEND->handle)
@ -273,7 +273,7 @@ mesalink_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
/* Informational message */ /* Informational message */
infof(data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID");
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
} }
@ -326,7 +326,7 @@ mesalink_connect_step2(struct Curl_easy *data,
connssl->connecting_state = ssl_connect_3; connssl->connecting_state = ssl_connect_3;
infof(data, infof(data,
"SSL connection using %s / %s\n", "SSL connection using %s / %s",
SSL_get_version(BACKEND->handle), SSL_get_version(BACKEND->handle),
SSL_get_cipher_name(BACKEND->handle)); SSL_get_cipher_name(BACKEND->handle));
@ -356,7 +356,7 @@ mesalink_connect_step3(struct connectdata *conn, int sockindex)
sockindex)); sockindex));
if(incache) { if(incache) {
if(old_ssl_sessionid != our_ssl_sessionid) { if(old_ssl_sessionid != our_ssl_sessionid) {
infof(data, "old SSL session ID is stale, removing\n"); infof(data, "old SSL session ID is stale, removing");
Curl_ssl_delsessionid(data, old_ssl_sessionid); Curl_ssl_delsessionid(data, old_ssl_sessionid);
incache = FALSE; incache = FALSE;
} }

View File

@ -433,7 +433,7 @@ static char *dup_nickname(struct Curl_easy *data, const char *str)
n = strchr(str, '/'); n = strchr(str, '/');
if(!n) { if(!n) {
infof(data, "warning: certificate file name \"%s\" handled as nickname; " infof(data, "warning: certificate file name \"%s\" handled as nickname; "
"please use \"./%s\" to force file name\n", str, str); "please use \"./%s\" to force file name", str, str);
return strdup(str); return strdup(str);
} }
@ -824,7 +824,7 @@ static SECStatus nss_auth_cert_hook(void *arg, PRFileDesc *fd, PRBool checksig,
#endif #endif
if(!SSL_CONN_CONFIG(verifypeer)) { if(!SSL_CONN_CONFIG(verifypeer)) {
infof(data, "skipping SSL peer certificate verification\n"); infof(data, "skipping SSL peer certificate verification");
return SECSuccess; return SECSuccess;
} }
@ -857,15 +857,15 @@ static void HandshakeCallback(PRFileDesc *sock, void *arg)
#endif #endif
case SSL_NEXT_PROTO_NO_SUPPORT: case SSL_NEXT_PROTO_NO_SUPPORT:
case SSL_NEXT_PROTO_NO_OVERLAP: case SSL_NEXT_PROTO_NO_OVERLAP:
infof(data, "ALPN/NPN, server did not agree to a protocol\n"); infof(data, "ALPN/NPN, server did not agree to a protocol");
return; return;
#ifdef SSL_ENABLE_ALPN #ifdef SSL_ENABLE_ALPN
case SSL_NEXT_PROTO_SELECTED: case SSL_NEXT_PROTO_SELECTED:
infof(data, "ALPN, server accepted to use %.*s\n", buflen, buf); infof(data, "ALPN, server accepted to use %.*s", buflen, buf);
break; break;
#endif #endif
case SSL_NEXT_PROTO_NEGOTIATED: case SSL_NEXT_PROTO_NEGOTIATED:
infof(data, "NPN, server accepted to use %.*s\n", buflen, buf); infof(data, "NPN, server accepted to use %.*s", buflen, buf);
break; break;
} }
@ -937,7 +937,7 @@ static SECStatus CanFalseStartCallback(PRFileDesc *sock, void *client_data,
*canFalseStart = PR_TRUE; *canFalseStart = PR_TRUE;
infof(data, "Trying TLS False Start\n"); infof(data, "Trying TLS False Start");
end: end:
return SECSuccess; return SECSuccess;
@ -955,17 +955,17 @@ static void display_cert_info(struct Curl_easy *data,
subject = CERT_NameToAscii(&cert->subject); subject = CERT_NameToAscii(&cert->subject);
issuer = CERT_NameToAscii(&cert->issuer); issuer = CERT_NameToAscii(&cert->issuer);
common_name = CERT_GetCommonName(&cert->subject); common_name = CERT_GetCommonName(&cert->subject);
infof(data, "\tsubject: %s\n", subject); infof(data, "subject: %s\n", subject);
CERT_GetCertTimes(cert, &notBefore, &notAfter); CERT_GetCertTimes(cert, &notBefore, &notAfter);
PR_ExplodeTime(notBefore, PR_GMTParameters, &printableTime); PR_ExplodeTime(notBefore, PR_GMTParameters, &printableTime);
PR_FormatTime(timeString, 256, "%b %d %H:%M:%S %Y GMT", &printableTime); PR_FormatTime(timeString, 256, "%b %d %H:%M:%S %Y GMT", &printableTime);
infof(data, "\tstart date: %s\n", timeString); infof(data, " start date: %s", timeString);
PR_ExplodeTime(notAfter, PR_GMTParameters, &printableTime); PR_ExplodeTime(notAfter, PR_GMTParameters, &printableTime);
PR_FormatTime(timeString, 256, "%b %d %H:%M:%S %Y GMT", &printableTime); PR_FormatTime(timeString, 256, "%b %d %H:%M:%S %Y GMT", &printableTime);
infof(data, "\texpire date: %s\n", timeString); infof(data, " expire date: %s", timeString);
infof(data, "\tcommon name: %s\n", common_name); infof(data, " common name: %s", common_name);
infof(data, "\tissuer: %s\n", issuer); infof(data, " issuer: %s", issuer);
PR_Free(subject); PR_Free(subject);
PR_Free(issuer); PR_Free(issuer);
@ -987,13 +987,13 @@ static CURLcode display_conn_info(struct Curl_easy *data, PRFileDesc *sock)
channel.cipherSuite) { channel.cipherSuite) {
if(SSL_GetCipherSuiteInfo(channel.cipherSuite, if(SSL_GetCipherSuiteInfo(channel.cipherSuite,
&suite, sizeof(suite)) == SECSuccess) { &suite, sizeof(suite)) == SECSuccess) {
infof(data, "SSL connection using %s\n", suite.cipherSuiteName); infof(data, "SSL connection using %s", suite.cipherSuiteName);
} }
} }
cert = SSL_PeerCertificate(sock); cert = SSL_PeerCertificate(sock);
if(cert) { if(cert) {
infof(data, "Server certificate:\n"); infof(data, "Server certificate:");
if(!data->set.ssl.certinfo) { if(!data->set.ssl.certinfo) {
display_cert_info(data, cert); display_cert_info(data, cert);
@ -1058,7 +1058,7 @@ static SECStatus BadCertHandler(void *arg, PRFileDesc *sock)
/* print only info about the cert, the error is printed off the callback */ /* print only info about the cert, the error is printed off the callback */
cert = SSL_PeerCertificate(sock); cert = SSL_PeerCertificate(sock);
if(cert) { if(cert) {
infof(data, "Server certificate:\n"); infof(data, "Server certificate:");
display_cert_info(data, cert); display_cert_info(data, cert);
CERT_DestroyCertificate(cert); CERT_DestroyCertificate(cert);
} }
@ -1132,7 +1132,7 @@ static CURLcode cmp_peer_pubkey(struct ssl_connect_data *connssl,
/* report the resulting status */ /* report the resulting status */
switch(result) { switch(result) {
case CURLE_OK: case CURLE_OK:
infof(data, "pinned public key verified successfully!\n"); infof(data, "pinned public key verified successfully!");
break; break;
case CURLE_SSL_PINNEDPUBKEYNOTMATCH: case CURLE_SSL_PINNEDPUBKEYNOTMATCH:
failf(data, "failed to verify pinned public key"); failf(data, "failed to verify pinned public key");
@ -1196,7 +1196,7 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
return SECFailure; return SECFailure;
} }
infof(data, "NSS: client certificate from file\n"); infof(data, "NSS: client certificate from file");
display_cert_info(data, cert); display_cert_info(data, cert);
*pRetCert = cert; *pRetCert = cert;
@ -1234,7 +1234,7 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
return SECFailure; return SECFailure;
} }
infof(data, "NSS: using client certificate: %s\n", nickname); infof(data, "NSS: using client certificate: %s", nickname);
display_cert_info(data, *pRetCert); display_cert_info(data, *pRetCert);
return SECSuccess; return SECSuccess;
} }
@ -1355,7 +1355,7 @@ static CURLcode nss_init_core(struct Curl_easy *data, const char *cert_dir)
if(!certpath) if(!certpath)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
infof(data, "Initializing NSS with certpath: %s\n", certpath); infof(data, "Initializing NSS with certpath: %s", certpath);
nss_context = NSS_InitContext(certpath, "", "", "", &initparams, nss_context = NSS_InitContext(certpath, "", "", "", &initparams,
NSS_INIT_READONLY | NSS_INIT_PK11RELOAD); NSS_INIT_READONLY | NSS_INIT_PK11RELOAD);
free(certpath); free(certpath);
@ -1365,10 +1365,10 @@ static CURLcode nss_init_core(struct Curl_easy *data, const char *cert_dir)
err = PR_GetError(); err = PR_GetError();
err_name = nss_error_to_name(err); err_name = nss_error_to_name(err);
infof(data, "Unable to initialize NSS database: %d (%s)\n", err, err_name); infof(data, "Unable to initialize NSS database: %d (%s)", err, err_name);
} }
infof(data, "Initializing NSS with certpath: none\n"); infof(data, "Initializing NSS with certpath: none");
nss_context = NSS_InitContext("", "", "", "", &initparams, NSS_INIT_READONLY nss_context = NSS_InitContext("", "", "", "", &initparams, NSS_INIT_READONLY
| NSS_INIT_NOCERTDB | NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN | NSS_INIT_NOCERTDB | NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN
| NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE | NSS_INIT_PK11RELOAD); | NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE | NSS_INIT_PK11RELOAD);
@ -1658,8 +1658,8 @@ static CURLcode nss_load_ca_certificates(struct Curl_easy *data,
if(capath && !capath[0]) if(capath && !capath[0])
capath = NULL; capath = NULL;
infof(data, " CAfile: %s\n", cafile ? cafile : "none"); infof(data, " CAfile: %s", cafile ? cafile : "none");
infof(data, " CApath: %s\n", capath ? capath : "none"); infof(data, " CApath: %s", capath ? capath : "none");
/* load libnssckbi.so if no other trust roots were specified */ /* load libnssckbi.so if no other trust roots were specified */
use_trust_module = !cafile && !capath; use_trust_module = !cafile && !capath;
@ -1668,7 +1668,7 @@ static CURLcode nss_load_ca_certificates(struct Curl_easy *data,
if(use_trust_module && !trust_module) { if(use_trust_module && !trust_module) {
/* libnssckbi.so needed but not yet loaded --> load it! */ /* libnssckbi.so needed but not yet loaded --> load it! */
result = nss_load_module(&trust_module, trust_library, "trust"); result = nss_load_module(&trust_module, trust_library, "trust");
infof(data, "%s %s\n", (result) ? "failed to load" : "loaded", infof(data, "%s %s", (result) ? "failed to load" : "loaded",
trust_library); trust_library);
if(result == CURLE_FAILED_INIT) if(result == CURLE_FAILED_INIT)
/* If libnssckbi.so is not available (or fails to load), one can still /* If libnssckbi.so is not available (or fails to load), one can still
@ -1677,7 +1677,7 @@ static CURLcode nss_load_ca_certificates(struct Curl_easy *data,
} }
else if(!use_trust_module && trust_module) { else if(!use_trust_module && trust_module) {
/* libnssckbi.so not needed but already loaded --> unload it! */ /* libnssckbi.so not needed but already loaded --> unload it! */
infof(data, "unloading %s\n", trust_library); infof(data, "unloading %s", trust_library);
nss_unload_module(&trust_module); nss_unload_module(&trust_module);
} }
PR_Unlock(nss_trustload_lock); PR_Unlock(nss_trustload_lock);
@ -1710,7 +1710,7 @@ static CURLcode nss_load_ca_certificates(struct Curl_easy *data,
if(CURLE_OK != nss_load_cert(&conn->ssl[sockindex], fullpath, PR_TRUE)) if(CURLE_OK != nss_load_cert(&conn->ssl[sockindex], fullpath, PR_TRUE))
/* This is purposefully tolerant of errors so non-PEM files can /* This is purposefully tolerant of errors so non-PEM files can
* be in the same directory */ * be in the same directory */
infof(data, "failed to load '%s' from CURLOPT_CAPATH\n", fullpath); infof(data, "failed to load '%s' from CURLOPT_CAPATH", fullpath);
free(fullpath); free(fullpath);
} }
@ -1718,7 +1718,7 @@ static CURLcode nss_load_ca_certificates(struct Curl_easy *data,
PR_CloseDir(dir); PR_CloseDir(dir);
} }
else else
infof(data, "warning: CURLOPT_CAPATH not a directory (%s)\n", capath); infof(data, "warning: CURLOPT_CAPATH not a directory (%s)", capath);
} }
return CURLE_OK; return CURLE_OK;
@ -1821,7 +1821,7 @@ static CURLcode nss_fail_connect(struct ssl_connect_data *connssl,
curlerr = CURLE_SSL_CERTPROBLEM; curlerr = CURLE_SSL_CERTPROBLEM;
/* print the error number and error string */ /* print the error number and error string */
infof(data, "NSS error %d (%s)\n", err, nss_error_to_name(err)); infof(data, "NSS error %d (%s)", err, nss_error_to_name(err));
/* print a human-readable message describing the error if available */ /* print a human-readable message describing the error if available */
nss_print_error_message(data, err); nss_print_error_message(data, err);
@ -1895,7 +1895,7 @@ static CURLcode nss_setup_connect(struct Curl_easy *data,
PR_Unlock(nss_initlock); PR_Unlock(nss_initlock);
if(result == CURLE_FAILED_INIT) if(result == CURLE_FAILED_INIT)
infof(data, "WARNING: failed to load NSS PEM library %s. Using " infof(data, "WARNING: failed to load NSS PEM library %s. Using "
"OpenSSL PEM certificates will not work.\n", pem_library); "OpenSSL PEM certificates will not work.", pem_library);
else if(result) else if(result)
goto error; goto error;
@ -1930,8 +1930,8 @@ static CURLcode nss_setup_connect(struct Curl_easy *data,
sslver_req_str = nss_sslver_to_name(sslver.max); sslver_req_str = nss_sslver_to_name(sslver.max);
sslver_supp_str = nss_sslver_to_name(sslver_supported.max); sslver_supp_str = nss_sslver_to_name(sslver_supported.max);
if(sslver_req_str && sslver_supp_str) if(sslver_req_str && sslver_supp_str)
infof(data, "Falling back from %s to max supported SSL version (%s)\n", infof(data, "Falling back from %s to max supported SSL version (%s)",
sslver_req_str, sslver_supp_str); sslver_req_str, sslver_supp_str);
free(sslver_req_str); free(sslver_req_str);
free(sslver_supp_str); free(sslver_supp_str);
sslver.max = sslver_supported.max; sslver.max = sslver_supported.max;
@ -1944,11 +1944,11 @@ static CURLcode nss_setup_connect(struct Curl_easy *data,
/* unless the user explicitly asks to allow the protocol vulnerability, we /* unless the user explicitly asks to allow the protocol vulnerability, we
use the work-around */ use the work-around */
if(SSL_OptionSet(model, SSL_CBC_RANDOM_IV, ssl_cbc_random_iv) != SECSuccess) if(SSL_OptionSet(model, SSL_CBC_RANDOM_IV, ssl_cbc_random_iv) != SECSuccess)
infof(data, "warning: failed to set SSL_CBC_RANDOM_IV = %d\n", infof(data, "warning: failed to set SSL_CBC_RANDOM_IV = %d",
ssl_cbc_random_iv); ssl_cbc_random_iv);
#else #else
if(ssl_cbc_random_iv) if(ssl_cbc_random_iv)
infof(data, "warning: support for SSL_CBC_RANDOM_IV not compiled in\n"); infof(data, "warning: support for SSL_CBC_RANDOM_IV not compiled in");
#endif #endif
if(SSL_CONN_CONFIG(cipher_list)) { if(SSL_CONN_CONFIG(cipher_list)) {
@ -1959,7 +1959,7 @@ static CURLcode nss_setup_connect(struct Curl_easy *data,
} }
if(!SSL_CONN_CONFIG(verifypeer) && SSL_CONN_CONFIG(verifyhost)) if(!SSL_CONN_CONFIG(verifypeer) && SSL_CONN_CONFIG(verifyhost))
infof(data, "warning: ignoring value of ssl.verifyhost\n"); infof(data, "warning: ignoring value of ssl.verifyhost");
/* bypass the default SSL_AuthCertificate() hook in case we do not want to /* bypass the default SSL_AuthCertificate() hook in case we do not want to
* verify peer */ * verify peer */
@ -1979,7 +1979,7 @@ static CURLcode nss_setup_connect(struct Curl_easy *data,
const CURLcode rv = nss_load_ca_certificates(data, conn, sockindex); const CURLcode rv = nss_load_ca_certificates(data, conn, sockindex);
if((rv == CURLE_SSL_CACERT_BADFILE) && !SSL_CONN_CONFIG(verifypeer)) if((rv == CURLE_SSL_CACERT_BADFILE) && !SSL_CONN_CONFIG(verifypeer))
/* not a fatal error because we are not going to verify the peer */ /* not a fatal error because we are not going to verify the peer */
infof(data, "warning: CA certificates failed to load\n"); infof(data, "warning: CA certificates failed to load");
else if(rv) { else if(rv) {
result = rv; result = rv;
goto error; goto error;
@ -1992,7 +1992,7 @@ static CURLcode nss_setup_connect(struct Curl_easy *data,
result = rv; result = rv;
goto error; goto error;
} }
infof(data, " CRLfile: %s\n", SSL_SET_OPTION(CRLfile)); infof(data, " CRLfile: %s", SSL_SET_OPTION(CRLfile));
} }
if(SSL_SET_OPTION(primary.clientcert)) { if(SSL_SET_OPTION(primary.clientcert)) {
@ -2197,12 +2197,12 @@ static CURLcode nss_do_connect(struct Curl_easy *data,
} }
if(SECFailure == ret) { if(SECFailure == ret) {
infof(data, "SSL certificate issuer check failed\n"); infof(data, "SSL certificate issuer check failed");
result = CURLE_SSL_ISSUER_ERROR; result = CURLE_SSL_ISSUER_ERROR;
goto error; goto error;
} }
else { else {
infof(data, "SSL certificate issuer check ok\n"); infof(data, "SSL certificate issuer check ok");
} }
} }
@ -2314,7 +2314,7 @@ static ssize_t nss_send(struct Curl_easy *data, /* transfer */
else { else {
/* print the error number and error string */ /* print the error number and error string */
const char *err_name = nss_error_to_name(err); const char *err_name = nss_error_to_name(err);
infof(data, "SSL write: error %d (%s)\n", err, err_name); infof(data, "SSL write: error %d (%s)", err, err_name);
/* print a human-readable message describing the error if available */ /* print a human-readable message describing the error if available */
nss_print_error_message(data, err); nss_print_error_message(data, err);
@ -2356,7 +2356,7 @@ static ssize_t nss_recv(struct Curl_easy *data, /* transfer */
else { else {
/* print the error number and error string */ /* print the error number and error string */
const char *err_name = nss_error_to_name(err); const char *err_name = nss_error_to_name(err);
infof(data, "SSL read: errno %d (%s)\n", err, err_name); infof(data, "SSL read: errno %d (%s)", err, err_name);
/* print a human-readable message describing the error if available */ /* print a human-readable message describing the error if available */
nss_print_error_message(data, err); nss_print_error_message(data, err);
@ -2435,7 +2435,7 @@ static bool nss_false_start(void)
} }
static void *nss_get_internals(struct ssl_connect_data *connssl, static void *nss_get_internals(struct ssl_connect_data *connssl,
CURLINFO info UNUSED_PARAM) CURLINFO info UNUSED_PARAM)
{ {
struct ssl_backend_data *backend = connssl->backend; struct ssl_backend_data *backend = connssl->backend;
(void)info; (void)info;

View File

@ -517,7 +517,7 @@ static CURLcode ossl_seed(struct Curl_easy *data)
return CURLE_OK; return CURLE_OK;
} }
infof(data, "libcurl is now using a weak random seed!\n"); infof(data, "libcurl is now using a weak random seed!");
return (rand_enough() ? CURLE_OK : return (rand_enough() ? CURLE_OK :
CURLE_SSL_CONNECT_ERROR /* confusing error code */); CURLE_SSL_CONNECT_ERROR /* confusing error code */);
} }
@ -1353,7 +1353,7 @@ static CURLcode ossl_set_engine_default(struct Curl_easy *data)
#ifdef USE_OPENSSL_ENGINE #ifdef USE_OPENSSL_ENGINE
if(data->state.engine) { if(data->state.engine) {
if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) { if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) {
infof(data, "set default crypto engine '%s'\n", infof(data, "set default crypto engine '%s'",
ENGINE_get_id(data->state.engine)); ENGINE_get_id(data->state.engine));
} }
else { else {
@ -1481,11 +1481,11 @@ static int ossl_shutdown(struct Curl_easy *data,
break; break;
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
/* there's data pending, re-invoke SSL_read() */ /* there's data pending, re-invoke SSL_read() */
infof(data, "SSL_ERROR_WANT_READ\n"); infof(data, "SSL_ERROR_WANT_READ");
break; break;
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
/* SSL wants a write. Really odd. Let's bail out. */ /* SSL wants a write. Really odd. Let's bail out. */
infof(data, "SSL_ERROR_WANT_WRITE\n"); infof(data, "SSL_ERROR_WANT_WRITE");
done = TRUE; done = TRUE;
break; break;
default: default:
@ -1517,14 +1517,14 @@ static int ossl_shutdown(struct Curl_easy *data,
#ifdef HAVE_SSL_GET_SHUTDOWN #ifdef HAVE_SSL_GET_SHUTDOWN
switch(SSL_get_shutdown(backend->handle)) { switch(SSL_get_shutdown(backend->handle)) {
case SSL_SENT_SHUTDOWN: case SSL_SENT_SHUTDOWN:
infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN\n"); infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN");
break; break;
case SSL_RECEIVED_SHUTDOWN: case SSL_RECEIVED_SHUTDOWN:
infof(data, "SSL_get_shutdown() returned SSL_RECEIVED_SHUTDOWN\n"); infof(data, "SSL_get_shutdown() returned SSL_RECEIVED_SHUTDOWN");
break; break;
case SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN: case SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN:
infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN|" infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN|"
"SSL_RECEIVED__SHUTDOWN\n"); "SSL_RECEIVED__SHUTDOWN");
break; break;
} }
#endif #endif
@ -1591,7 +1591,7 @@ static bool subj_alt_hostcheck(struct Curl_easy *data,
if(Curl_cert_hostcheck(match_pattern2, hostname)) { if(Curl_cert_hostcheck(match_pattern2, hostname)) {
res = TRUE; res = TRUE;
infof(data, infof(data,
" subjectAltName: host \"%s\" matched cert's \"%s\"\n", " subjectAltName: host \"%s\" matched cert's \"%s\"",
dispname, match_pattern2); dispname, match_pattern2);
} }
} }
@ -1610,7 +1610,7 @@ static bool subj_alt_hostcheck(struct Curl_easy *data,
(void)data; (void)data;
#endif #endif
if(Curl_cert_hostcheck(match_pattern, hostname)) { if(Curl_cert_hostcheck(match_pattern, hostname)) {
infof(data, " subjectAltName: host \"%s\" matched cert's \"%s\"\n", infof(data, " subjectAltName: host \"%s\" matched cert's \"%s\"",
dispname, match_pattern); dispname, match_pattern);
return TRUE; return TRUE;
} }
@ -1730,7 +1730,7 @@ static CURLcode verifyhost(struct Curl_easy *data, struct connectdata *conn,
if((altlen == addrlen) && !memcmp(altptr, &addr, altlen)) { if((altlen == addrlen) && !memcmp(altptr, &addr, altlen)) {
ipmatched = TRUE; ipmatched = TRUE;
infof(data, infof(data,
" subjectAltName: host \"%s\" matched cert's IP address!\n", " subjectAltName: host \"%s\" matched cert's IP address!",
dispname); dispname);
} }
break; break;
@ -1747,7 +1747,7 @@ static CURLcode verifyhost(struct Curl_easy *data, struct connectdata *conn,
/* an alternative name matched */ /* an alternative name matched */
; ;
else if(dNSName || iPAddress) { else if(dNSName || iPAddress) {
infof(data, " subjectAltName does not match %s\n", dispname); infof(data, " subjectAltName does not match %s", dispname);
failf(data, "SSL: no alternative certificate subject name matches " failf(data, "SSL: no alternative certificate subject name matches "
"target host name '%s'", dispname); "target host name '%s'", dispname);
result = CURLE_PEER_FAILED_VERIFICATION; result = CURLE_PEER_FAILED_VERIFICATION;
@ -1829,7 +1829,7 @@ static CURLcode verifyhost(struct Curl_easy *data, struct connectdata *conn,
result = CURLE_PEER_FAILED_VERIFICATION; result = CURLE_PEER_FAILED_VERIFICATION;
} }
else { else {
infof(data, " common name: %s (matched)\n", peer_CN); infof(data, " common name: %s (matched)", peer_CN);
} }
if(peer_CN) if(peer_CN)
OPENSSL_free(peer_CN); OPENSSL_free(peer_CN);
@ -1965,7 +1965,7 @@ static CURLcode verifystatus(struct Curl_easy *data,
goto end; goto end;
} }
infof(data, "SSL certificate status: %s (%d)\n", infof(data, "SSL certificate status: %s (%d)",
OCSP_cert_status_str(cert_status), cert_status); OCSP_cert_status_str(cert_status), cert_status);
switch(cert_status) { switch(cert_status) {
@ -2269,7 +2269,7 @@ select_next_proto_cb(SSL *ssl,
#ifdef USE_HTTP2 #ifdef USE_HTTP2
if(data->state.httpwant >= CURL_HTTP_VERSION_2 && if(data->state.httpwant >= CURL_HTTP_VERSION_2 &&
!select_next_protocol(out, outlen, in, inlen, ALPN_H2, ALPN_H2_LENGTH)) { !select_next_protocol(out, outlen, in, inlen, ALPN_H2, ALPN_H2_LENGTH)) {
infof(data, "NPN, negotiated HTTP2 (%s)\n", ALPN_H2); infof(data, "NPN, negotiated HTTP2 (%s)", ALPN_H2);
conn->negnpn = CURL_HTTP_VERSION_2; conn->negnpn = CURL_HTTP_VERSION_2;
return SSL_TLSEXT_ERR_OK; return SSL_TLSEXT_ERR_OK;
} }
@ -2277,12 +2277,12 @@ select_next_proto_cb(SSL *ssl,
if(!select_next_protocol(out, outlen, in, inlen, ALPN_HTTP_1_1, if(!select_next_protocol(out, outlen, in, inlen, ALPN_HTTP_1_1,
ALPN_HTTP_1_1_LENGTH)) { ALPN_HTTP_1_1_LENGTH)) {
infof(data, "NPN, negotiated HTTP1.1\n"); infof(data, "NPN, negotiated HTTP1.1");
conn->negnpn = CURL_HTTP_VERSION_1_1; conn->negnpn = CURL_HTTP_VERSION_1_1;
return SSL_TLSEXT_ERR_OK; return SSL_TLSEXT_ERR_OK;
} }
infof(data, "NPN, no overlap, use HTTP1.1\n"); infof(data, "NPN, no overlap, use HTTP1.1");
*out = (unsigned char *)ALPN_HTTP_1_1; *out = (unsigned char *)ALPN_HTTP_1_1;
*outlen = ALPN_HTTP_1_1_LENGTH; *outlen = ALPN_HTTP_1_1_LENGTH;
conn->negnpn = CURL_HTTP_VERSION_1_1; conn->negnpn = CURL_HTTP_VERSION_1_1;
@ -2499,7 +2499,7 @@ static int ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid)
&old_ssl_sessionid, NULL, sockindex)); &old_ssl_sessionid, NULL, sockindex));
if(incache) { if(incache) {
if(old_ssl_sessionid != ssl_sessionid) { if(old_ssl_sessionid != ssl_sessionid) {
infof(data, "old SSL session ID is stale, removing\n"); infof(data, "old SSL session ID is stale, removing");
Curl_ssl_delsessionid(data, old_ssl_sessionid); Curl_ssl_delsessionid(data, old_ssl_sessionid);
incache = FALSE; incache = FALSE;
} }
@ -2793,14 +2793,14 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
memcpy(&protocols[cur], ALPN_H2, ALPN_H2_LENGTH); memcpy(&protocols[cur], ALPN_H2, ALPN_H2_LENGTH);
cur += ALPN_H2_LENGTH; cur += ALPN_H2_LENGTH;
infof(data, "ALPN, offering %s\n", ALPN_H2); infof(data, "ALPN, offering %s", ALPN_H2);
} }
#endif #endif
protocols[cur++] = ALPN_HTTP_1_1_LENGTH; protocols[cur++] = ALPN_HTTP_1_1_LENGTH;
memcpy(&protocols[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH); memcpy(&protocols[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH);
cur += ALPN_HTTP_1_1_LENGTH; cur += ALPN_HTTP_1_1_LENGTH;
infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1); infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
/* expects length prefixed preference ordered list of protocols in wire /* expects length prefixed preference ordered list of protocols in wire
* format * format
@ -2832,7 +2832,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
failf(data, "failed setting cipher list: %s", ciphers); failf(data, "failed setting cipher list: %s", ciphers);
return CURLE_SSL_CIPHER; return CURLE_SSL_CIPHER;
} }
infof(data, "Cipher selection: %s\n", ciphers); infof(data, "Cipher selection: %s", ciphers);
} }
#ifdef HAVE_SSL_CTX_SET_CIPHERSUITES #ifdef HAVE_SSL_CTX_SET_CIPHERSUITES
@ -2843,7 +2843,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
failf(data, "failed setting TLS 1.3 cipher suite: %s", ciphers13); failf(data, "failed setting TLS 1.3 cipher suite: %s", ciphers13);
return CURLE_SSL_CIPHER; return CURLE_SSL_CIPHER;
} }
infof(data, "TLS 1.3 cipher selection: %s\n", ciphers13); infof(data, "TLS 1.3 cipher selection: %s", ciphers13);
} }
} }
#endif #endif
@ -2869,7 +2869,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
if(ssl_authtype == CURL_TLSAUTH_SRP) { if(ssl_authtype == CURL_TLSAUTH_SRP) {
char * const ssl_username = SSL_SET_OPTION(username); char * const ssl_username = SSL_SET_OPTION(username);
infof(data, "Using TLS-SRP username: %s\n", ssl_username); infof(data, "Using TLS-SRP username: %s", ssl_username);
if(!SSL_CTX_set_srp_username(backend->ctx, ssl_username)) { if(!SSL_CTX_set_srp_username(backend->ctx, ssl_username)) {
failf(data, "Unable to set SRP user name"); failf(data, "Unable to set SRP user name");
@ -2880,7 +2880,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_BAD_FUNCTION_ARGUMENT;
} }
if(!SSL_CONN_CONFIG(cipher_list)) { if(!SSL_CONN_CONFIG(cipher_list)) {
infof(data, "Setting cipher list SRP\n"); infof(data, "Setting cipher list SRP");
if(!SSL_CTX_set_cipher_list(backend->ctx, "SRP")) { if(!SSL_CTX_set_cipher_list(backend->ctx, "SRP")) {
failf(data, "failed setting SRP cipher list"); failf(data, "failed setting SRP cipher list");
@ -2933,7 +2933,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
NULL, cert_name, sizeof(cert_name))) { NULL, cert_name, sizeof(cert_name))) {
strcpy(cert_name, "Unknown"); strcpy(cert_name, "Unknown");
} }
infof(data, "SSL: Checking cert \"%s\"\n", cert_name); infof(data, "SSL: Checking cert %s\"\n", cert_name);
#endif #endif
encoded_cert = (const unsigned char *)pContext->pbCertEncoded; encoded_cert = (const unsigned char *)pContext->pbCertEncoded;
@ -3015,7 +3015,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
OpenSSL. */ OpenSSL. */
if(X509_STORE_add_cert(store, x509) == 1) { if(X509_STORE_add_cert(store, x509) == 1) {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
infof(data, "SSL: Imported cert \"%s\"\n", cert_name); infof(data, "SSL: Imported cert \"%s\"", cert_name);
#endif #endif
imported_native_ca = true; imported_native_ca = true;
} }
@ -3030,9 +3030,9 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
return result; return result;
} }
if(imported_native_ca) if(imported_native_ca)
infof(data, "successfully imported windows ca store\n"); infof(data, "successfully imported windows ca store");
else else
infof(data, "error importing windows ca store, continuing anyway\n"); infof(data, "error importing windows ca store, continuing anyway");
} }
#endif #endif
@ -3045,7 +3045,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
return result; return result;
} }
/* Only warning if no certificate verification is required. */ /* Only warning if no certificate verification is required. */
infof(data, "error importing CA certificate blob, continuing anyway\n"); infof(data, "error importing CA certificate blob, continuing anyway");
} }
} }
@ -3060,9 +3060,9 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CACERT_BADFILE; return CURLE_SSL_CACERT_BADFILE;
} }
/* Continue with a warning if no certificate verif is required. */ /* Continue with a warning if no certificate verif is required. */
infof(data, "error setting certificate file, continuing anyway\n"); infof(data, "error setting certificate file, continuing anyway");
} }
infof(data, " CAfile: %s\n", ssl_cafile); infof(data, " CAfile: %s", ssl_cafile);
} }
if(ssl_capath) { if(ssl_capath) {
if(!SSL_CTX_load_verify_dir(backend->ctx, ssl_capath)) { if(!SSL_CTX_load_verify_dir(backend->ctx, ssl_capath)) {
@ -3072,9 +3072,9 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CACERT_BADFILE; return CURLE_SSL_CACERT_BADFILE;
} }
/* Continue with a warning if no certificate verif is required. */ /* Continue with a warning if no certificate verif is required. */
infof(data, "error setting certificate path, continuing anyway\n"); infof(data, "error setting certificate path, continuing anyway");
} }
infof(data, " CApath: %s\n", ssl_capath); infof(data, " CApath: %s", ssl_capath);
} }
} }
#else #else
@ -3093,14 +3093,14 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
/* Just continue with a warning if no strict certificate verification /* Just continue with a warning if no strict certificate verification
is required. */ is required. */
infof(data, "error setting certificate verify locations," infof(data, "error setting certificate verify locations,"
" continuing anyway:\n"); " continuing anyway:");
} }
else { else {
/* Everything is fine. */ /* Everything is fine. */
infof(data, "successfully set certificate verify locations:\n"); infof(data, "successfully set certificate verify locations:");
} }
infof(data, " CAfile: %s\n", ssl_cafile ? ssl_cafile : "none"); infof(data, " CAfile: %s", ssl_cafile ? ssl_cafile : "none");
infof(data, " CApath: %s\n", ssl_capath ? ssl_capath : "none"); infof(data, " CApath: %s", ssl_capath ? ssl_capath : "none");
} }
#endif #endif
@ -3124,11 +3124,11 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CRL_BADFILE; return CURLE_SSL_CRL_BADFILE;
} }
/* Everything is fine. */ /* Everything is fine. */
infof(data, "successfully load CRL file:\n"); infof(data, "successfully load CRL file:");
X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx), X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx),
X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL); X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
infof(data, " CRLfile: %s\n", ssl_crlfile); infof(data, " CRLfile: %s", ssl_crlfile);
} }
if(verifypeer) { if(verifypeer) {
@ -3232,7 +3232,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
data->state.buffer[nlen] = 0; data->state.buffer[nlen] = 0;
if(!SSL_set_tlsext_host_name(backend->handle, data->state.buffer)) if(!SSL_set_tlsext_host_name(backend->handle, data->state.buffer))
infof(data, "WARNING: failed to configure server name indication (SNI) " infof(data, "WARNING: failed to configure server name indication (SNI) "
"TLS extension\n"); "TLS extension");
} }
#endif #endif
@ -3250,7 +3250,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
/* Informational message */ /* Informational message */
infof(data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID");
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
@ -3405,7 +3405,7 @@ static CURLcode ossl_connect_step2(struct Curl_easy *data,
connssl->connecting_state = ssl_connect_3; connssl->connecting_state = ssl_connect_3;
/* Informational message */ /* Informational message */
infof(data, "SSL connection using %s / %s\n", infof(data, "SSL connection using %s / %s",
SSL_get_version(backend->handle), SSL_get_version(backend->handle),
SSL_get_cipher(backend->handle)); SSL_get_cipher(backend->handle));
@ -3418,7 +3418,7 @@ static CURLcode ossl_connect_step2(struct Curl_easy *data,
unsigned int len; unsigned int len;
SSL_get0_alpn_selected(backend->handle, &neg_protocol, &len); SSL_get0_alpn_selected(backend->handle, &neg_protocol, &len);
if(len) { if(len) {
infof(data, "ALPN, server accepted to use %.*s\n", len, neg_protocol); infof(data, "ALPN, server accepted to use %.*s", len, neg_protocol);
#ifdef USE_HTTP2 #ifdef USE_HTTP2
if(len == ALPN_H2_LENGTH && if(len == ALPN_H2_LENGTH &&
@ -3433,7 +3433,7 @@ static CURLcode ossl_connect_step2(struct Curl_easy *data,
} }
} }
else else
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE); BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
@ -3643,7 +3643,7 @@ static CURLcode get_cert_chain(struct Curl_easy *data,
pubkey = X509_get_pubkey(x); pubkey = X509_get_pubkey(x);
if(!pubkey) if(!pubkey)
infof(data, " Unable to load public key\n"); infof(data, " Unable to load public key");
else { else {
int pktype; int pktype;
#ifdef HAVE_OPAQUE_EVP_PKEY #ifdef HAVE_OPAQUE_EVP_PKEY
@ -3857,23 +3857,23 @@ static CURLcode servercert(struct Curl_easy *data,
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
infof(data, "%s certificate:\n", SSL_IS_PROXY() ? "Proxy" : "Server"); infof(data, "%s certificate:", SSL_IS_PROXY() ? "Proxy" : "Server");
rc = x509_name_oneline(X509_get_subject_name(backend->server_cert), rc = x509_name_oneline(X509_get_subject_name(backend->server_cert),
buffer, sizeof(buffer)); buffer, sizeof(buffer));
infof(data, " subject: %s\n", rc?"[NONE]":buffer); infof(data, " subject: %s", rc?"[NONE]":buffer);
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
{ {
long len; long len;
ASN1_TIME_print(mem, X509_get0_notBefore(backend->server_cert)); ASN1_TIME_print(mem, X509_get0_notBefore(backend->server_cert));
len = BIO_get_mem_data(mem, (char **) &ptr); len = BIO_get_mem_data(mem, (char **) &ptr);
infof(data, " start date: %.*s\n", (int)len, ptr); infof(data, " start date: %.*s", (int)len, ptr);
(void)BIO_reset(mem); (void)BIO_reset(mem);
ASN1_TIME_print(mem, X509_get0_notAfter(backend->server_cert)); ASN1_TIME_print(mem, X509_get0_notAfter(backend->server_cert));
len = BIO_get_mem_data(mem, (char **) &ptr); len = BIO_get_mem_data(mem, (char **) &ptr);
infof(data, " expire date: %.*s\n", (int)len, ptr); infof(data, " expire date: %.*s", (int)len, ptr);
(void)BIO_reset(mem); (void)BIO_reset(mem);
} }
#endif #endif
@ -3897,7 +3897,7 @@ static CURLcode servercert(struct Curl_easy *data,
result = CURLE_PEER_FAILED_VERIFICATION; result = CURLE_PEER_FAILED_VERIFICATION;
} }
else { else {
infof(data, " issuer: %s\n", buffer); infof(data, " issuer: %s", buffer);
/* We could do all sorts of certificate verification stuff here before /* We could do all sorts of certificate verification stuff here before
deallocating the certificate. */ deallocating the certificate. */
@ -3954,7 +3954,7 @@ static CURLcode servercert(struct Curl_easy *data,
return CURLE_SSL_ISSUER_ERROR; return CURLE_SSL_ISSUER_ERROR;
} }
infof(data, " SSL certificate issuer check ok (%s)\n", infof(data, " SSL certificate issuer check ok (%s)",
SSL_SET_OPTION(issuercert)); SSL_SET_OPTION(issuercert));
BIO_free(fp); BIO_free(fp);
X509_free(issuer); X509_free(issuer);
@ -3973,11 +3973,11 @@ static CURLcode servercert(struct Curl_easy *data,
} }
else else
infof(data, " SSL certificate verify result: %s (%ld)," infof(data, " SSL certificate verify result: %s (%ld),"
" continuing anyway.\n", " continuing anyway.",
X509_verify_cert_error_string(lerr), lerr); X509_verify_cert_error_string(lerr), lerr);
} }
else else
infof(data, " SSL certificate verify ok.\n"); infof(data, " SSL certificate verify ok.");
} }
#if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \ #if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \

View File

@ -73,7 +73,7 @@ cr_connect(struct Curl_easy *data UNUSED_PARAM,
struct connectdata *conn UNUSED_PARAM, struct connectdata *conn UNUSED_PARAM,
int sockindex UNUSED_PARAM) int sockindex UNUSED_PARAM)
{ {
infof(data, "rustls_connect: unimplemented\n"); infof(data, "rustls_connect: unimplemented");
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
@ -129,7 +129,7 @@ cr_recv(struct Curl_easy *data, int sockindex,
io_error = rustls_connection_read_tls(rconn, read_cb, io_error = rustls_connection_read_tls(rconn, read_cb,
&conn->sock[sockindex], &tls_bytes_read); &conn->sock[sockindex], &tls_bytes_read);
if(io_error == EAGAIN || io_error == EWOULDBLOCK) { if(io_error == EAGAIN || io_error == EWOULDBLOCK) {
infof(data, "sread: EAGAIN or EWOULDBLOCK\n"); infof(data, "sread: EAGAIN or EWOULDBLOCK");
} }
else if(io_error) { else if(io_error) {
failf(data, "reading from socket: %s", strerror(io_error)); failf(data, "reading from socket: %s", strerror(io_error));
@ -142,7 +142,7 @@ cr_recv(struct Curl_easy *data, int sockindex,
return -1; return -1;
} }
infof(data, "cr_recv read %ld bytes from the network\n", tls_bytes_read); infof(data, "cr_recv read %ld bytes from the network", tls_bytes_read);
rresult = rustls_connection_process_new_packets(rconn); rresult = rustls_connection_process_new_packets(rconn);
if(rresult != RUSTLS_RESULT_OK) { if(rresult != RUSTLS_RESULT_OK) {
@ -173,12 +173,12 @@ cr_recv(struct Curl_easy *data, int sockindex,
available data has been read." If we bring in more ciphertext with available data has been read." If we bring in more ciphertext with
read_tls, more plaintext will become available. So don't tell curl read_tls, more plaintext will become available. So don't tell curl
this is an EOF. Instead, say "come back later." */ this is an EOF. Instead, say "come back later." */
infof(data, "cr_recv got 0 bytes of plaintext\n"); infof(data, "cr_recv got 0 bytes of plaintext");
backend->data_pending = FALSE; backend->data_pending = FALSE;
break; break;
} }
else { else {
infof(data, "cr_recv copied out %ld bytes of plaintext\n", n); infof(data, "cr_recv copied out %ld bytes of plaintext", n);
plain_bytes_copied += n; plain_bytes_copied += n;
} }
} }
@ -218,7 +218,7 @@ cr_send(struct Curl_easy *data, int sockindex,
rustls_result rresult; rustls_result rresult;
rustls_io_result io_error; rustls_io_result io_error;
infof(data, "cr_send %ld bytes of plaintext\n", plainlen); infof(data, "cr_send %ld bytes of plaintext", plainlen);
if(plainlen > 0) { if(plainlen > 0) {
rresult = rustls_connection_write(rconn, plainbuf, plainlen, rresult = rustls_connection_write(rconn, plainbuf, plainlen,
@ -239,7 +239,7 @@ cr_send(struct Curl_easy *data, int sockindex,
io_error = rustls_connection_write_tls(rconn, write_cb, io_error = rustls_connection_write_tls(rconn, write_cb,
&conn->sock[sockindex], &tlswritten); &conn->sock[sockindex], &tlswritten);
if(io_error == EAGAIN || io_error == EWOULDBLOCK) { if(io_error == EAGAIN || io_error == EWOULDBLOCK) {
infof(data, "swrite: EAGAIN after %ld bytes\n", tlswritten_total); infof(data, "swrite: EAGAIN after %ld bytes", tlswritten_total);
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
return -1; return -1;
} }
@ -253,7 +253,7 @@ cr_send(struct Curl_easy *data, int sockindex,
*err = CURLE_WRITE_ERROR; *err = CURLE_WRITE_ERROR;
return -1; return -1;
} }
infof(data, "cr_send wrote %ld bytes to network\n", tlswritten); infof(data, "cr_send wrote %ld bytes to network", tlswritten);
tlswritten_total += tlswritten; tlswritten_total += tlswritten;
} }
@ -304,10 +304,10 @@ cr_init_backend(struct Curl_easy *data, struct connectdata *conn,
config_builder = rustls_client_config_builder_new(); config_builder = rustls_client_config_builder_new();
#ifdef USE_HTTP2 #ifdef USE_HTTP2
infof(data, "offering ALPN for HTTP/1.1 and HTTP/2\n"); infof(data, "offering ALPN for HTTP/1.1 and HTTP/2");
rustls_client_config_builder_set_protocols(config_builder, alpn, 2); rustls_client_config_builder_set_protocols(config_builder, alpn, 2);
#else #else
infof(data, "offering ALPN for HTTP/1.1 only\n"); infof(data, "offering ALPN for HTTP/1.1 only");
rustls_client_config_builder_set_protocols(config_builder, alpn, 1); rustls_client_config_builder_set_protocols(config_builder, alpn, 1);
#endif #endif
if(!verifypeer) { if(!verifypeer) {
@ -355,24 +355,24 @@ cr_set_negotiated_alpn(struct Curl_easy *data, struct connectdata *conn,
rustls_connection_get_alpn_protocol(rconn, &protocol, &len); rustls_connection_get_alpn_protocol(rconn, &protocol, &len);
if(NULL == protocol) { if(NULL == protocol) {
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
return; return;
} }
#ifdef USE_HTTP2 #ifdef USE_HTTP2
if(len == ALPN_H2_LENGTH && 0 == memcmp(ALPN_H2, protocol, len)) { if(len == ALPN_H2_LENGTH && 0 == memcmp(ALPN_H2, protocol, len)) {
infof(data, "ALPN, negotiated h2\n"); infof(data, "ALPN, negotiated h2");
conn->negnpn = CURL_HTTP_VERSION_2; conn->negnpn = CURL_HTTP_VERSION_2;
} }
else else
#endif #endif
if(len == ALPN_HTTP_1_1_LENGTH && if(len == ALPN_HTTP_1_1_LENGTH &&
0 == memcmp(ALPN_HTTP_1_1, protocol, len)) { 0 == memcmp(ALPN_HTTP_1_1, protocol, len)) {
infof(data, "ALPN, negotiated http/1.1\n"); infof(data, "ALPN, negotiated http/1.1");
conn->negnpn = CURL_HTTP_VERSION_1_1; conn->negnpn = CURL_HTTP_VERSION_1_1;
} }
else { else {
infof(data, "ALPN, negotiated an unrecognized protocol\n"); infof(data, "ALPN, negotiated an unrecognized protocol");
} }
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
@ -415,7 +415,7 @@ cr_connect_nonblocking(struct Curl_easy *data, struct connectdata *conn,
* once the handshake is done. * once the handshake is done.
*/ */
if(!rustls_connection_is_handshaking(rconn)) { if(!rustls_connection_is_handshaking(rconn)) {
infof(data, "Done handshaking\n"); infof(data, "Done handshaking");
/* Done with the handshake. Set up callbacks to send/receive data. */ /* Done with the handshake. Set up callbacks to send/receive data. */
connssl->state = ssl_connection_complete; connssl->state = ssl_connection_complete;
@ -440,22 +440,19 @@ cr_connect_nonblocking(struct Curl_easy *data, struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
if(0 == what) { if(0 == what) {
infof(data, "Curl_socket_check: %s would block\n", infof(data, "Curl_socket_check: %s would block",
wants_read&&wants_write ? wants_read&&wants_write ? "writing and reading" :
"writing and reading" : wants_write ? "writing" : "reading");
wants_write ?
"writing" :
"reading");
*done = FALSE; *done = FALSE;
return CURLE_OK; return CURLE_OK;
} }
/* socket is readable or writable */ /* socket is readable or writable */
if(wants_write) { if(wants_write) {
infof(data, "rustls_connection wants us to write_tls.\n"); infof(data, "rustls_connection wants us to write_tls.");
cr_send(data, sockindex, NULL, 0, &tmperr); cr_send(data, sockindex, NULL, 0, &tmperr);
if(tmperr == CURLE_AGAIN) { if(tmperr == CURLE_AGAIN) {
infof(data, "writing would block\n"); infof(data, "writing would block");
/* fall through */ /* fall through */
} }
else if(tmperr != CURLE_OK) { else if(tmperr != CURLE_OK) {
@ -464,11 +461,11 @@ cr_connect_nonblocking(struct Curl_easy *data, struct connectdata *conn,
} }
if(wants_read) { if(wants_read) {
infof(data, "rustls_connection wants us to read_tls.\n"); infof(data, "rustls_connection wants us to read_tls.");
cr_recv(data, sockindex, NULL, 0, &tmperr); cr_recv(data, sockindex, NULL, 0, &tmperr);
if(tmperr == CURLE_AGAIN) { if(tmperr == CURLE_AGAIN) {
infof(data, "reading would block\n"); infof(data, "reading would block");
/* fall through */ /* fall through */
} }
else if(tmperr != CURLE_OK) { else if(tmperr != CURLE_OK) {

View File

@ -441,7 +441,7 @@ schannel_acquire_credential_handle(struct Curl_easy *data,
SCH_CRED_IGNORE_REVOCATION_OFFLINE; SCH_CRED_IGNORE_REVOCATION_OFFLINE;
DEBUGF(infof(data, "schannel: disabled server certificate revocation " DEBUGF(infof(data, "schannel: disabled server certificate revocation "
"checks\n")); "checks"));
} }
else if(SSL_SET_OPTION(revoke_best_effort)) { else if(SSL_SET_OPTION(revoke_best_effort)) {
schannel_cred.dwFlags |= SCH_CRED_IGNORE_NO_REVOCATION_CHECK | schannel_cred.dwFlags |= SCH_CRED_IGNORE_NO_REVOCATION_CHECK |
@ -453,7 +453,7 @@ schannel_acquire_credential_handle(struct Curl_easy *data,
schannel_cred.dwFlags |= SCH_CRED_REVOCATION_CHECK_CHAIN; schannel_cred.dwFlags |= SCH_CRED_REVOCATION_CHECK_CHAIN;
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: checking server certificate revocation\n")); "schannel: checking server certificate revocation"));
} }
} }
else { else {
@ -461,23 +461,23 @@ schannel_acquire_credential_handle(struct Curl_easy *data,
SCH_CRED_IGNORE_NO_REVOCATION_CHECK | SCH_CRED_IGNORE_NO_REVOCATION_CHECK |
SCH_CRED_IGNORE_REVOCATION_OFFLINE; SCH_CRED_IGNORE_REVOCATION_OFFLINE;
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: disabled server cert revocation checks\n")); "schannel: disabled server cert revocation checks"));
} }
if(!conn->ssl_config.verifyhost) { if(!conn->ssl_config.verifyhost) {
schannel_cred.dwFlags |= SCH_CRED_NO_SERVERNAME_CHECK; schannel_cred.dwFlags |= SCH_CRED_NO_SERVERNAME_CHECK;
DEBUGF(infof(data, "schannel: verifyhost setting prevents Schannel from " DEBUGF(infof(data, "schannel: verifyhost setting prevents Schannel from "
"comparing the supplied target name with the subject " "comparing the supplied target name with the subject "
"names in server certificates.\n")); "names in server certificates."));
} }
if(!SSL_SET_OPTION(auto_client_cert)) { if(!SSL_SET_OPTION(auto_client_cert)) {
schannel_cred.dwFlags &= ~SCH_CRED_USE_DEFAULT_CREDS; schannel_cred.dwFlags &= ~SCH_CRED_USE_DEFAULT_CREDS;
schannel_cred.dwFlags |= SCH_CRED_NO_DEFAULT_CREDS; schannel_cred.dwFlags |= SCH_CRED_NO_DEFAULT_CREDS;
infof(data, "schannel: disabled automatic use of client certificate\n"); infof(data, "schannel: disabled automatic use of client certificate");
} }
else else
infof(data, "schannel: enabled automatic use of client certificate\n"); infof(data, "schannel: enabled automatic use of client certificate");
switch(conn->ssl_config.version) { switch(conn->ssl_config.version) {
case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_DEFAULT:
@ -773,7 +773,7 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
char * const hostname = SSL_HOST_NAME(); char * const hostname = SSL_HOST_NAME();
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: SSL/TLS connection with %s port %hu (step 1/3)\n", "schannel: SSL/TLS connection with %s port %hu (step 1/3)",
hostname, conn->remote_port)); hostname, conn->remote_port));
if(curlx_verify_windows_version(5, 1, PLATFORM_WINNT, if(curlx_verify_windows_version(5, 1, PLATFORM_WINNT,
@ -781,7 +781,7 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
/* Schannel in Windows XP (OS version 5.1) uses legacy handshakes and /* Schannel in Windows XP (OS version 5.1) uses legacy handshakes and
algorithms that may not be supported by all servers. */ algorithms that may not be supported by all servers. */
infof(data, "schannel: Windows version is old and may not be able to " infof(data, "schannel: Windows version is old and may not be able to "
"connect to some servers due to lack of SNI, algorithms, etc.\n"); "connect to some servers due to lack of SNI, algorithms, etc.");
} }
#ifdef HAS_ALPN #ifdef HAS_ALPN
@ -836,12 +836,12 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
SSL_IS_PROXY() ? TRUE : FALSE, SSL_IS_PROXY() ? TRUE : FALSE,
(void **)&old_cred, NULL, sockindex)) { (void **)&old_cred, NULL, sockindex)) {
BACKEND->cred = old_cred; BACKEND->cred = old_cred;
DEBUGF(infof(data, "schannel: re-using existing credential handle\n")); DEBUGF(infof(data, "schannel: re-using existing credential handle"));
/* increment the reference counter of the credential/session handle */ /* increment the reference counter of the credential/session handle */
BACKEND->cred->refcount++; BACKEND->cred->refcount++;
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: incremented credential handle refcount = %d\n", "schannel: incremented credential handle refcount = %d",
BACKEND->cred->refcount)); BACKEND->cred->refcount));
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
@ -860,7 +860,7 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
|| Curl_inet_pton(AF_INET6, hostname, &addr6) || Curl_inet_pton(AF_INET6, hostname, &addr6)
#endif #endif
) { ) {
infof(data, "schannel: using IP address, SNI is not supported by OS.\n"); infof(data, "schannel: using IP address, SNI is not supported by OS.");
} }
#ifdef HAS_ALPN #ifdef HAS_ALPN
@ -893,14 +893,14 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
alpn_buffer[cur++] = ALPN_H2_LENGTH; alpn_buffer[cur++] = ALPN_H2_LENGTH;
memcpy(&alpn_buffer[cur], ALPN_H2, ALPN_H2_LENGTH); memcpy(&alpn_buffer[cur], ALPN_H2, ALPN_H2_LENGTH);
cur += ALPN_H2_LENGTH; cur += ALPN_H2_LENGTH;
infof(data, "schannel: ALPN, offering %s\n", ALPN_H2); infof(data, "schannel: ALPN, offering %s", ALPN_H2);
} }
#endif #endif
alpn_buffer[cur++] = ALPN_HTTP_1_1_LENGTH; alpn_buffer[cur++] = ALPN_HTTP_1_1_LENGTH;
memcpy(&alpn_buffer[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH); memcpy(&alpn_buffer[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH);
cur += ALPN_HTTP_1_1_LENGTH; cur += ALPN_HTTP_1_1_LENGTH;
infof(data, "schannel: ALPN, offering %s\n", ALPN_HTTP_1_1); infof(data, "schannel: ALPN, offering %s", ALPN_HTTP_1_1);
*list_len = curlx_uitous(cur - list_start_index); *list_len = curlx_uitous(cur - list_start_index);
*extension_len = *list_len + sizeof(unsigned int) + sizeof(unsigned short); *extension_len = *list_len + sizeof(unsigned int) + sizeof(unsigned short);
@ -988,7 +988,7 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
} }
DEBUGF(infof(data, "schannel: sending initial handshake data: " DEBUGF(infof(data, "schannel: sending initial handshake data: "
"sending %lu bytes...\n", outbuf.cbBuffer)); "sending %lu bytes.", outbuf.cbBuffer));
/* send initial handshake data which is now stored in output buffer */ /* send initial handshake data which is now stored in output buffer */
result = Curl_write_plain(data, conn->sock[sockindex], outbuf.pvBuffer, result = Curl_write_plain(data, conn->sock[sockindex], outbuf.pvBuffer,
@ -1001,7 +1001,7 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
} }
DEBUGF(infof(data, "schannel: sent initial handshake data: " DEBUGF(infof(data, "schannel: sent initial handshake data: "
"sent %zd bytes\n", written)); "sent %zd bytes", written));
BACKEND->recv_unrecoverable_err = CURLE_OK; BACKEND->recv_unrecoverable_err = CURLE_OK;
BACKEND->recv_sspi_close_notify = false; BACKEND->recv_sspi_close_notify = false;
@ -1035,7 +1035,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
doread = (connssl->connecting_state != ssl_connect_2_writing) ? TRUE : FALSE; doread = (connssl->connecting_state != ssl_connect_2_writing) ? TRUE : FALSE;
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: SSL/TLS connection with %s port %hu (step 2/3)\n", "schannel: SSL/TLS connection with %s port %hu (step 2/3)",
hostname, conn->remote_port)); hostname, conn->remote_port));
if(!BACKEND->cred || !BACKEND->ctxt) if(!BACKEND->cred || !BACKEND->ctxt)
@ -1097,7 +1097,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
if(connssl->connecting_state != ssl_connect_2_writing) if(connssl->connecting_state != ssl_connect_2_writing)
connssl->connecting_state = ssl_connect_2_reading; connssl->connecting_state = ssl_connect_2_reading;
DEBUGF(infof(data, "schannel: failed to receive handshake, " DEBUGF(infof(data, "schannel: failed to receive handshake, "
"need more data\n")); "need more data"));
return CURLE_OK; return CURLE_OK;
} }
else if((result != CURLE_OK) || (nread == 0)) { else if((result != CURLE_OK) || (nread == 0)) {
@ -1109,11 +1109,11 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
/* increase encrypted data buffer offset */ /* increase encrypted data buffer offset */
BACKEND->encdata_offset += nread; BACKEND->encdata_offset += nread;
BACKEND->encdata_is_incomplete = false; BACKEND->encdata_is_incomplete = false;
DEBUGF(infof(data, "schannel: encrypted data got %zd\n", nread)); DEBUGF(infof(data, "schannel: encrypted data got %zd", nread));
} }
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: encrypted data buffer: offset %zu length %zu\n", "schannel: encrypted data buffer: offset %zu length %zu",
BACKEND->encdata_offset, BACKEND->encdata_length)); BACKEND->encdata_offset, BACKEND->encdata_length));
/* setup input buffers */ /* setup input buffers */
@ -1158,7 +1158,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
BACKEND->encdata_is_incomplete = true; BACKEND->encdata_is_incomplete = true;
connssl->connecting_state = ssl_connect_2_reading; connssl->connecting_state = ssl_connect_2_reading;
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: received incomplete message, need more data\n")); "schannel: received incomplete message, need more data"));
return CURLE_OK; return CURLE_OK;
} }
@ -1170,7 +1170,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
BACKEND->req_flags |= ISC_REQ_USE_SUPPLIED_CREDS; BACKEND->req_flags |= ISC_REQ_USE_SUPPLIED_CREDS;
connssl->connecting_state = ssl_connect_2_writing; connssl->connecting_state = ssl_connect_2_writing;
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: a client certificate has been requested\n")); "schannel: a client certificate has been requested"));
return CURLE_OK; return CURLE_OK;
} }
@ -1180,7 +1180,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
/* search for handshake tokens that need to be send */ /* search for handshake tokens that need to be send */
if(outbuf[i].BufferType == SECBUFFER_TOKEN && outbuf[i].cbBuffer > 0) { if(outbuf[i].BufferType == SECBUFFER_TOKEN && outbuf[i].cbBuffer > 0) {
DEBUGF(infof(data, "schannel: sending next handshake data: " DEBUGF(infof(data, "schannel: sending next handshake data: "
"sending %lu bytes...\n", outbuf[i].cbBuffer)); "sending %lu bytes.", outbuf[i].cbBuffer));
/* send handshake token to server */ /* send handshake token to server */
result = Curl_write_plain(data, conn->sock[sockindex], result = Curl_write_plain(data, conn->sock[sockindex],
@ -1235,7 +1235,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
/* check if there was additional remaining encrypted data */ /* check if there was additional remaining encrypted data */
if(inbuf[1].BufferType == SECBUFFER_EXTRA && inbuf[1].cbBuffer > 0) { if(inbuf[1].BufferType == SECBUFFER_EXTRA && inbuf[1].cbBuffer > 0) {
DEBUGF(infof(data, "schannel: encrypted data length: %lu\n", DEBUGF(infof(data, "schannel: encrypted data length: %lu",
inbuf[1].cbBuffer)); inbuf[1].cbBuffer));
/* /*
There are two cases where we could be getting extra data here: There are two cases where we could be getting extra data here:
@ -1275,7 +1275,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
/* check if the handshake is complete */ /* check if the handshake is complete */
if(sspi_status == SEC_E_OK) { if(sspi_status == SEC_E_OK) {
connssl->connecting_state = ssl_connect_3; connssl->connecting_state = ssl_connect_3;
DEBUGF(infof(data, "schannel: SSL/TLS handshake complete\n")); DEBUGF(infof(data, "schannel: SSL/TLS handshake complete"));
} }
pubkey_ptr = SSL_PINNED_PUB_KEY(); pubkey_ptr = SSL_PINNED_PUB_KEY();
@ -1374,7 +1374,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state); DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: SSL/TLS connection with %s port %hu (step 3/3)\n", "schannel: SSL/TLS connection with %s port %hu (step 3/3)",
hostname, conn->remote_port)); hostname, conn->remote_port));
if(!BACKEND->cred) if(!BACKEND->cred)
@ -1410,7 +1410,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
if(alpn_result.ProtoNegoStatus == if(alpn_result.ProtoNegoStatus ==
SecApplicationProtocolNegotiationStatus_Success) { SecApplicationProtocolNegotiationStatus_Success) {
infof(data, "schannel: ALPN, server accepted to use %.*s\n", infof(data, "schannel: ALPN, server accepted to use %.*s",
alpn_result.ProtocolIdSize, alpn_result.ProtocolId); alpn_result.ProtocolIdSize, alpn_result.ProtocolId);
#ifdef USE_HTTP2 #ifdef USE_HTTP2
@ -1427,7 +1427,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
} }
} }
else else
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE); BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
} }
@ -1444,7 +1444,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
if(incache) { if(incache) {
if(old_cred != BACKEND->cred) { if(old_cred != BACKEND->cred) {
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: old credential handle is stale, removing\n")); "schannel: old credential handle is stale, removing"));
/* we're not taking old_cred ownership here, no refcount++ is needed */ /* we're not taking old_cred ownership here, no refcount++ is needed */
Curl_ssl_delsessionid(data, (void *)old_cred); Curl_ssl_delsessionid(data, (void *)old_cred);
incache = FALSE; incache = FALSE;
@ -1463,7 +1463,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
/* this cred session is now also referenced by sessionid cache */ /* this cred session is now also referenced by sessionid cache */
BACKEND->cred->refcount++; BACKEND->cred->refcount++;
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: stored credential handle in session cache\n")); "schannel: stored credential handle in session cache"));
} }
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
@ -1794,21 +1794,21 @@ schannel_recv(struct Curl_easy *data, int sockindex,
* handled in the cleanup. * handled in the cleanup.
*/ */
DEBUGF(infof(data, "schannel: client wants to read %zu bytes\n", len)); DEBUGF(infof(data, "schannel: client wants to read %zu bytes", len));
*err = CURLE_OK; *err = CURLE_OK;
if(len && len <= BACKEND->decdata_offset) { if(len && len <= BACKEND->decdata_offset) {
infof(data, "schannel: enough decrypted data is already available\n"); infof(data, "schannel: enough decrypted data is already available");
goto cleanup; goto cleanup;
} }
else if(BACKEND->recv_unrecoverable_err) { else if(BACKEND->recv_unrecoverable_err) {
*err = BACKEND->recv_unrecoverable_err; *err = BACKEND->recv_unrecoverable_err;
infof(data, "schannel: an unrecoverable error occurred in a prior call\n"); infof(data, "schannel: an unrecoverable error occurred in a prior call");
goto cleanup; goto cleanup;
} }
else if(BACKEND->recv_sspi_close_notify) { else if(BACKEND->recv_sspi_close_notify) {
/* once a server has indicated shutdown there is no more encrypted data */ /* once a server has indicated shutdown there is no more encrypted data */
infof(data, "schannel: server indicated shutdown in a prior call\n"); infof(data, "schannel: server indicated shutdown in a prior call");
goto cleanup; goto cleanup;
} }
@ -1837,12 +1837,12 @@ schannel_recv(struct Curl_easy *data, int sockindex,
BACKEND->encdata_buffer = reallocated_buffer; BACKEND->encdata_buffer = reallocated_buffer;
BACKEND->encdata_length = reallocated_length; BACKEND->encdata_length = reallocated_length;
size = BACKEND->encdata_length - BACKEND->encdata_offset; size = BACKEND->encdata_length - BACKEND->encdata_offset;
DEBUGF(infof(data, "schannel: encdata_buffer resized %zu\n", DEBUGF(infof(data, "schannel: encdata_buffer resized %zu",
BACKEND->encdata_length)); BACKEND->encdata_length));
} }
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: encrypted data buffer: offset %zu length %zu\n", "schannel: encrypted data buffer: offset %zu length %zu",
BACKEND->encdata_offset, BACKEND->encdata_length)); BACKEND->encdata_offset, BACKEND->encdata_length));
/* read encrypted data from socket */ /* read encrypted data from socket */
@ -1854,25 +1854,25 @@ schannel_recv(struct Curl_easy *data, int sockindex,
nread = -1; nread = -1;
if(*err == CURLE_AGAIN) if(*err == CURLE_AGAIN)
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: Curl_read_plain returned CURLE_AGAIN\n")); "schannel: Curl_read_plain returned CURLE_AGAIN"));
else if(*err == CURLE_RECV_ERROR) else if(*err == CURLE_RECV_ERROR)
infof(data, "schannel: Curl_read_plain returned CURLE_RECV_ERROR\n"); infof(data, "schannel: Curl_read_plain returned CURLE_RECV_ERROR");
else else
infof(data, "schannel: Curl_read_plain returned error %d\n", *err); infof(data, "schannel: Curl_read_plain returned error %d", *err);
} }
else if(nread == 0) { else if(nread == 0) {
BACKEND->recv_connection_closed = true; BACKEND->recv_connection_closed = true;
DEBUGF(infof(data, "schannel: server closed the connection\n")); DEBUGF(infof(data, "schannel: server closed the connection"));
} }
else if(nread > 0) { else if(nread > 0) {
BACKEND->encdata_offset += (size_t)nread; BACKEND->encdata_offset += (size_t)nread;
BACKEND->encdata_is_incomplete = false; BACKEND->encdata_is_incomplete = false;
DEBUGF(infof(data, "schannel: encrypted data got %zd\n", nread)); DEBUGF(infof(data, "schannel: encrypted data got %zd", nread));
} }
} }
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: encrypted data buffer: offset %zu length %zu\n", "schannel: encrypted data buffer: offset %zu length %zu",
BACKEND->encdata_offset, BACKEND->encdata_length)); BACKEND->encdata_offset, BACKEND->encdata_length));
/* decrypt loop */ /* decrypt loop */
@ -1901,7 +1901,7 @@ schannel_recv(struct Curl_easy *data, int sockindex,
/* check for successfully decrypted data, even before actual /* check for successfully decrypted data, even before actual
renegotiation or shutdown of the connection context */ renegotiation or shutdown of the connection context */
if(inbuf[1].BufferType == SECBUFFER_DATA) { if(inbuf[1].BufferType == SECBUFFER_DATA) {
DEBUGF(infof(data, "schannel: decrypted data length: %lu\n", DEBUGF(infof(data, "schannel: decrypted data length: %lu",
inbuf[1].cbBuffer)); inbuf[1].cbBuffer));
/* increase buffer in order to fit the received amount of data */ /* increase buffer in order to fit the received amount of data */
@ -1934,15 +1934,15 @@ schannel_recv(struct Curl_easy *data, int sockindex,
BACKEND->decdata_offset += size; BACKEND->decdata_offset += size;
} }
DEBUGF(infof(data, "schannel: decrypted data added: %zu\n", size)); DEBUGF(infof(data, "schannel: decrypted data added: %zu", size));
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: decrypted cached: offset %zu length %zu\n", "schannel: decrypted cached: offset %zu length %zu",
BACKEND->decdata_offset, BACKEND->decdata_length)); BACKEND->decdata_offset, BACKEND->decdata_length));
} }
/* check for remaining encrypted data */ /* check for remaining encrypted data */
if(inbuf[3].BufferType == SECBUFFER_EXTRA && inbuf[3].cbBuffer > 0) { if(inbuf[3].BufferType == SECBUFFER_EXTRA && inbuf[3].cbBuffer > 0) {
DEBUGF(infof(data, "schannel: encrypted data length: %lu\n", DEBUGF(infof(data, "schannel: encrypted data length: %lu",
inbuf[3].cbBuffer)); inbuf[3].cbBuffer));
/* check if the remaining data is less than the total amount /* check if the remaining data is less than the total amount
@ -1958,7 +1958,7 @@ schannel_recv(struct Curl_easy *data, int sockindex,
} }
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: encrypted cached: offset %zu length %zu\n", "schannel: encrypted cached: offset %zu length %zu",
BACKEND->encdata_offset, BACKEND->encdata_length)); BACKEND->encdata_offset, BACKEND->encdata_length));
} }
else { else {
@ -1968,29 +1968,29 @@ schannel_recv(struct Curl_easy *data, int sockindex,
/* check if server wants to renegotiate the connection context */ /* check if server wants to renegotiate the connection context */
if(sspi_status == SEC_I_RENEGOTIATE) { if(sspi_status == SEC_I_RENEGOTIATE) {
infof(data, "schannel: remote party requests renegotiation\n"); infof(data, "schannel: remote party requests renegotiation");
if(*err && *err != CURLE_AGAIN) { if(*err && *err != CURLE_AGAIN) {
infof(data, "schannel: can't renogotiate, an error is pending\n"); infof(data, "schannel: can't renogotiate, an error is pending");
goto cleanup; goto cleanup;
} }
if(BACKEND->encdata_offset) { if(BACKEND->encdata_offset) {
*err = CURLE_RECV_ERROR; *err = CURLE_RECV_ERROR;
infof(data, "schannel: can't renogotiate, " infof(data, "schannel: can't renogotiate, "
"encrypted data available\n"); "encrypted data available");
goto cleanup; goto cleanup;
} }
/* begin renegotiation */ /* begin renegotiation */
infof(data, "schannel: renegotiating SSL/TLS connection\n"); infof(data, "schannel: renegotiating SSL/TLS connection");
connssl->state = ssl_connection_negotiating; connssl->state = ssl_connection_negotiating;
connssl->connecting_state = ssl_connect_2_writing; connssl->connecting_state = ssl_connect_2_writing;
*err = schannel_connect_common(data, conn, sockindex, FALSE, &done); *err = schannel_connect_common(data, conn, sockindex, FALSE, &done);
if(*err) { if(*err) {
infof(data, "schannel: renegotiation failed\n"); infof(data, "schannel: renegotiation failed");
goto cleanup; goto cleanup;
} }
/* now retry receiving data */ /* now retry receiving data */
sspi_status = SEC_E_OK; sspi_status = SEC_E_OK;
infof(data, "schannel: SSL/TLS connection renegotiated\n"); infof(data, "schannel: SSL/TLS connection renegotiated");
continue; continue;
} }
/* check if the server closed the connection */ /* check if the server closed the connection */
@ -2000,7 +2000,7 @@ schannel_recv(struct Curl_easy *data, int sockindex,
BACKEND->recv_sspi_close_notify = true; BACKEND->recv_sspi_close_notify = true;
if(!BACKEND->recv_connection_closed) { if(!BACKEND->recv_connection_closed) {
BACKEND->recv_connection_closed = true; BACKEND->recv_connection_closed = true;
infof(data, "schannel: server closed the connection\n"); infof(data, "schannel: server closed the connection");
} }
goto cleanup; goto cleanup;
} }
@ -2009,7 +2009,7 @@ schannel_recv(struct Curl_easy *data, int sockindex,
BACKEND->encdata_is_incomplete = true; BACKEND->encdata_is_incomplete = true;
if(!*err) if(!*err)
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
infof(data, "schannel: failed to decrypt data, need more data\n"); infof(data, "schannel: failed to decrypt data, need more data");
goto cleanup; goto cleanup;
} }
else { else {
@ -2017,23 +2017,23 @@ schannel_recv(struct Curl_easy *data, int sockindex,
char buffer[STRERROR_LEN]; char buffer[STRERROR_LEN];
#endif #endif
*err = CURLE_RECV_ERROR; *err = CURLE_RECV_ERROR;
infof(data, "schannel: failed to read data from server: %s\n", infof(data, "schannel: failed to read data from server: %s",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer))); Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
goto cleanup; goto cleanup;
} }
} }
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: encrypted data buffer: offset %zu length %zu\n", "schannel: encrypted data buffer: offset %zu length %zu",
BACKEND->encdata_offset, BACKEND->encdata_length)); BACKEND->encdata_offset, BACKEND->encdata_length));
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: decrypted data buffer: offset %zu length %zu\n", "schannel: decrypted data buffer: offset %zu length %zu",
BACKEND->decdata_offset, BACKEND->decdata_length)); BACKEND->decdata_offset, BACKEND->decdata_length));
cleanup: cleanup:
/* Warning- there is no guarantee the encdata state is valid at this point */ /* Warning- there is no guarantee the encdata state is valid at this point */
DEBUGF(infof(data, "schannel: schannel_recv cleanup\n")); DEBUGF(infof(data, "schannel: schannel_recv cleanup"));
/* Error if the connection has closed without a close_notify. /* Error if the connection has closed without a close_notify.
@ -2055,7 +2055,7 @@ schannel_recv(struct Curl_easy *data, int sockindex,
BACKEND->recv_sspi_close_notify = true; BACKEND->recv_sspi_close_notify = true;
else { else {
*err = CURLE_RECV_ERROR; *err = CURLE_RECV_ERROR;
infof(data, "schannel: server closed abruptly (missing close_notify)\n"); infof(data, "schannel: server closed abruptly (missing close_notify)");
} }
} }
@ -2069,9 +2069,9 @@ schannel_recv(struct Curl_easy *data, int sockindex,
memmove(BACKEND->decdata_buffer, BACKEND->decdata_buffer + size, memmove(BACKEND->decdata_buffer, BACKEND->decdata_buffer + size,
BACKEND->decdata_offset - size); BACKEND->decdata_offset - size);
BACKEND->decdata_offset -= size; BACKEND->decdata_offset -= size;
DEBUGF(infof(data, "schannel: decrypted data returned %zu\n", size)); DEBUGF(infof(data, "schannel: decrypted data returned %zu", size));
DEBUGF(infof(data, DEBUGF(infof(data,
"schannel: decrypted data buffer: offset %zu length %zu\n", "schannel: decrypted data buffer: offset %zu length %zu",
BACKEND->decdata_offset, BACKEND->decdata_length)); BACKEND->decdata_offset, BACKEND->decdata_length));
*err = CURLE_OK; *err = CURLE_OK;
return (ssize_t)size; return (ssize_t)size;
@ -2155,7 +2155,7 @@ static int schannel_shutdown(struct Curl_easy *data, struct connectdata *conn,
DEBUGASSERT(data); DEBUGASSERT(data);
infof(data, "schannel: shutting down SSL/TLS connection with %s port %hu\n", infof(data, "schannel: shutting down SSL/TLS connection with %s port %hu",
hostname, conn->remote_port); hostname, conn->remote_port);
if(BACKEND->cred && BACKEND->ctxt) { if(BACKEND->cred && BACKEND->ctxt) {
@ -2213,14 +2213,14 @@ static int schannel_shutdown(struct Curl_easy *data, struct connectdata *conn,
s_pSecFn->FreeContextBuffer(outbuf.pvBuffer); s_pSecFn->FreeContextBuffer(outbuf.pvBuffer);
if((result != CURLE_OK) || (outbuf.cbBuffer != (size_t) written)) { if((result != CURLE_OK) || (outbuf.cbBuffer != (size_t) written)) {
infof(data, "schannel: failed to send close msg: %s" infof(data, "schannel: failed to send close msg: %s"
" (bytes written: %zd)\n", curl_easy_strerror(result), written); " (bytes written: %zd)", curl_easy_strerror(result), written);
} }
} }
} }
/* free SSPI Schannel API security context handle */ /* free SSPI Schannel API security context handle */
if(BACKEND->ctxt) { if(BACKEND->ctxt) {
DEBUGF(infof(data, "schannel: clear security context handle\n")); DEBUGF(infof(data, "schannel: clear security context handle"));
s_pSecFn->DeleteSecurityContext(&BACKEND->ctxt->ctxt_handle); s_pSecFn->DeleteSecurityContext(&BACKEND->ctxt->ctxt_handle);
Curl_safefree(BACKEND->ctxt); Curl_safefree(BACKEND->ctxt);
} }

View File

@ -204,12 +204,12 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store,
if(result == CURLE_OK) { if(result == CURLE_OK) {
if(!num_certs) { if(!num_certs) {
infof(data, infof(data,
"schannel: did not add any certificates from CA file '%s'\n", "schannel: did not add any certificates from CA file '%s'",
ca_file_text); ca_file_text);
} }
else { else {
infof(data, infof(data,
"schannel: added %d certificate(s) from CA file '%s'\n", "schannel: added %d certificate(s) from CA file '%s'",
num_certs, ca_file_text); num_certs, ca_file_text);
} }
} }
@ -526,7 +526,7 @@ static CURLcode verify_host(struct Curl_easy *data,
if(match_result == CURL_HOST_MATCH) { if(match_result == CURL_HOST_MATCH) {
infof(data, infof(data,
"schannel: connection hostname (%s) validated " "schannel: connection hostname (%s) validated "
"against certificate name (%s)\n", "against certificate name (%s)",
conn_hostname, cert_hostname); conn_hostname, cert_hostname);
result = CURLE_OK; result = CURLE_OK;
} }
@ -535,7 +535,7 @@ static CURLcode verify_host(struct Curl_easy *data,
infof(data, infof(data,
"schannel: connection hostname (%s) did not match " "schannel: connection hostname (%s) did not match "
"against certificate name (%s)\n", "against certificate name (%s)",
conn_hostname, cert_hostname); conn_hostname, cert_hostname);
cert_hostname_len = cert_hostname_len =

View File

@ -1644,7 +1644,7 @@ static CURLcode sectransp_set_selected_ciphers(struct Curl_easy *data,
} }
} }
/* All cipher suites in the list are found. Report to logs as-is */ /* All cipher suites in the list are found. Report to logs as-is */
infof(data, "SSL: Setting cipher suites list \"%s\"\n", ciphers); infof(data, "SSL: Setting cipher suites list \"%s\"", ciphers);
err = SSLSetEnabledCiphers(ssl_ctx, selected_ciphers, ciphers_count); err = SSLSetEnabledCiphers(ssl_ctx, selected_ciphers, ciphers_count);
if(err != noErr) { if(err != noErr) {
@ -1840,19 +1840,19 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
#endif #endif
) { ) {
CFArrayAppendValue(alpnArr, CFSTR(ALPN_H2)); CFArrayAppendValue(alpnArr, CFSTR(ALPN_H2));
infof(data, "ALPN, offering %s\n", ALPN_H2); infof(data, "ALPN, offering %s", ALPN_H2);
} }
#endif #endif
CFArrayAppendValue(alpnArr, CFSTR(ALPN_HTTP_1_1)); CFArrayAppendValue(alpnArr, CFSTR(ALPN_HTTP_1_1));
infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1); infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
/* expects length prefixed preference ordered list of protocols in wire /* expects length prefixed preference ordered list of protocols in wire
* format * format
*/ */
err = SSLSetALPNProtocols(backend->ssl_ctx, alpnArr); err = SSLSetALPNProtocols(backend->ssl_ctx, alpnArr);
if(err != noErr) if(err != noErr)
infof(data, "WARNING: failed to set ALPN protocols; OSStatus %d\n", infof(data, "WARNING: failed to set ALPN protocols; OSStatus %d",
err); err);
CFRelease(alpnArr); CFRelease(alpnArr);
} }
@ -1861,7 +1861,7 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
if(SSL_SET_OPTION(key)) { if(SSL_SET_OPTION(key)) {
infof(data, "WARNING: SSL: CURLOPT_SSLKEY is ignored by Secure " infof(data, "WARNING: SSL: CURLOPT_SSLKEY is ignored by Secure "
"Transport. The private key must be in the Keychain.\n"); "Transport. The private key must be in the Keychain.");
} }
if(ssl_cert || ssl_cert_blob) { if(ssl_cert || ssl_cert_blob) {
@ -1876,11 +1876,11 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
if(is_cert_file || is_cert_data) { if(is_cert_file || is_cert_data) {
if(!SSL_SET_OPTION(cert_type)) if(!SSL_SET_OPTION(cert_type))
infof(data, "WARNING: SSL: Certificate type not set, assuming " infof(data, "WARNING: SSL: Certificate type not set, assuming "
"PKCS#12 format.\n"); "PKCS#12 format.");
else if(strncmp(SSL_SET_OPTION(cert_type), "P12", else if(strncmp(SSL_SET_OPTION(cert_type), "P12",
strlen(SSL_SET_OPTION(cert_type))) != 0) strlen(SSL_SET_OPTION(cert_type))) != 0)
infof(data, "WARNING: SSL: The Security framework only supports " infof(data, "WARNING: SSL: The Security framework only supports "
"loading identities that are in PKCS#12 format.\n"); "loading identities that are in PKCS#12 format.");
err = CopyIdentityFromPKCS12File(ssl_cert, ssl_cert_blob, err = CopyIdentityFromPKCS12File(ssl_cert, ssl_cert_blob,
SSL_SET_OPTION(key_passwd), &cert_and_key); SSL_SET_OPTION(key_passwd), &cert_and_key);
@ -1899,7 +1899,7 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
char *certp; char *certp;
CURLcode result = CopyCertSubject(data, cert, &certp); CURLcode result = CopyCertSubject(data, cert, &certp);
if(!result) { if(!result) {
infof(data, "Client certificate: %s\n", certp); infof(data, "Client certificate: %s", certp);
free(certp); free(certp);
} }
@ -2025,7 +2025,7 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
strlen(hostname)); strlen(hostname));
if(err != noErr) { if(err != noErr) {
infof(data, "WARNING: SSL: SSLSetPeerDomainName() failed: OSStatus %d\n", infof(data, "WARNING: SSL: SSLSetPeerDomainName() failed: OSStatus %d",
err); err);
} }
@ -2035,11 +2035,11 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
#endif #endif
) { ) {
infof(data, "WARNING: using IP address, SNI is being disabled by " infof(data, "WARNING: using IP address, SNI is being disabled by "
"the OS.\n"); "the OS.");
} }
} }
else { else {
infof(data, "WARNING: disabling hostname validation also disables SNI.\n"); infof(data, "WARNING: disabling hostname validation also disables SNI.");
} }
ciphers = SSL_CONN_CONFIG(cipher_list); ciphers = SSL_CONN_CONFIG(cipher_list);
@ -2082,7 +2082,7 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
/* Informational message */ /* Informational message */
infof(data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID");
} }
/* If there isn't one, then let's make one up! This has to be done prior /* If there isn't one, then let's make one up! This has to be done prior
to starting the handshake. */ to starting the handshake. */
@ -2487,7 +2487,7 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
spkiHeaderLength = 23; spkiHeaderLength = 23;
break; break;
default: default:
infof(data, "SSL: unhandled public key length: %d\n", pubkeylen); infof(data, "SSL: unhandled public key length: %d", pubkeylen);
#elif SECTRANSP_PINNEDPUBKEY_V2 #elif SECTRANSP_PINNEDPUBKEY_V2
default: default:
/* ecDSA secp256r1 pubkeylen == 91 header already included? /* ecDSA secp256r1 pubkeylen == 91 header already included?
@ -2778,35 +2778,35 @@ sectransp_connect_step2(struct Curl_easy *data, struct connectdata *conn,
(void)SSLGetNegotiatedProtocolVersion(backend->ssl_ctx, &protocol); (void)SSLGetNegotiatedProtocolVersion(backend->ssl_ctx, &protocol);
switch(protocol) { switch(protocol) {
case kSSLProtocol2: case kSSLProtocol2:
infof(data, "SSL 2.0 connection using %s\n", infof(data, "SSL 2.0 connection using %s",
TLSCipherNameForNumber(cipher)); TLSCipherNameForNumber(cipher));
break; break;
case kSSLProtocol3: case kSSLProtocol3:
infof(data, "SSL 3.0 connection using %s\n", infof(data, "SSL 3.0 connection using %s",
TLSCipherNameForNumber(cipher)); TLSCipherNameForNumber(cipher));
break; break;
case kTLSProtocol1: case kTLSProtocol1:
infof(data, "TLS 1.0 connection using %s\n", infof(data, "TLS 1.0 connection using %s",
TLSCipherNameForNumber(cipher)); TLSCipherNameForNumber(cipher));
break; break;
#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS #if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS
case kTLSProtocol11: case kTLSProtocol11:
infof(data, "TLS 1.1 connection using %s\n", infof(data, "TLS 1.1 connection using %s",
TLSCipherNameForNumber(cipher)); TLSCipherNameForNumber(cipher));
break; break;
case kTLSProtocol12: case kTLSProtocol12:
infof(data, "TLS 1.2 connection using %s\n", infof(data, "TLS 1.2 connection using %s",
TLSCipherNameForNumber(cipher)); TLSCipherNameForNumber(cipher));
break; break;
#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */ #endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */
#if CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11 #if CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11
case kTLSProtocol13: case kTLSProtocol13:
infof(data, "TLS 1.3 connection using %s\n", infof(data, "TLS 1.3 connection using %s",
TLSCipherNameForNumber(cipher)); TLSCipherNameForNumber(cipher));
break; break;
#endif /* CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11 */ #endif /* CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11 */
default: default:
infof(data, "Unknown protocol connection\n"); infof(data, "Unknown protocol connection");
break; break;
} }
@ -2832,7 +2832,7 @@ sectransp_connect_step2(struct Curl_easy *data, struct connectdata *conn,
conn->negnpn = CURL_HTTP_VERSION_1_1; conn->negnpn = CURL_HTTP_VERSION_1_1;
} }
else else
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE); BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
@ -2881,7 +2881,7 @@ show_verbose_server_cert(struct Curl_easy *data,
server_cert = SecTrustGetCertificateAtIndex(trust, i); server_cert = SecTrustGetCertificateAtIndex(trust, i);
result = CopyCertSubject(data, server_cert, &certp); result = CopyCertSubject(data, server_cert, &certp);
if(!result) { if(!result) {
infof(data, "Server certificate: %s\n", certp); infof(data, "Server certificate: %s", certp);
free(certp); free(certp);
} }
} }
@ -2907,7 +2907,7 @@ show_verbose_server_cert(struct Curl_easy *data,
server_cert = SecTrustGetCertificateAtIndex(trust, i); server_cert = SecTrustGetCertificateAtIndex(trust, i);
result = CopyCertSubject(data, server_cert, &certp); result = CopyCertSubject(data, server_cert, &certp);
if(!result) { if(!result) {
infof(data, "Server certificate: %s\n", certp); infof(data, "Server certificate: %s", certp);
free(certp); free(certp);
} }
} }
@ -2927,7 +2927,7 @@ show_verbose_server_cert(struct Curl_easy *data,
i); i);
result = CopyCertSubject(data, server_cert, &certp); result = CopyCertSubject(data, server_cert, &certp);
if(!result) { if(!result) {
infof(data, "Server certificate: %s\n", certp); infof(data, "Server certificate: %s", certp);
free(certp); free(certp);
} }
} }
@ -2947,7 +2947,7 @@ show_verbose_server_cert(struct Curl_easy *data,
server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs, i); server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs, i);
result = CopyCertSubject(data, server_cert, &certp); result = CopyCertSubject(data, server_cert, &certp);
if(!result) { if(!result) {
infof(data, "Server certificate: %s\n", certp); infof(data, "Server certificate: %s", certp);
free(certp); free(certp);
} }
} }

View File

@ -444,7 +444,7 @@ bool Curl_ssl_getsessionid(struct Curl_easy *data,
} }
} }
DEBUGF(infof(data, "%s Session ID in cache for %s %s://%s:%d\n", DEBUGF(infof(data, "%s Session ID in cache for %s %s://%s:%d",
no_match? "Didn't find": "Found", no_match? "Didn't find": "Found",
isProxy ? "proxy" : "host", isProxy ? "proxy" : "host",
conn->handler->scheme, name, port)); conn->handler->scheme, name, port));
@ -593,7 +593,7 @@ CURLcode Curl_ssl_addsessionid(struct Curl_easy *data,
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
DEBUGF(infof(data, "Added Session ID to cache for %s://%s:%d [%s]\n", DEBUGF(infof(data, "Added Session ID to cache for %s://%s:%d [%s]",
store->scheme, store->name, store->remote_port, store->scheme, store->name, store->remote_port,
isProxy ? "PROXY" : "server")); isProxy ? "PROXY" : "server"));
return CURLE_OK; return CURLE_OK;
@ -953,7 +953,7 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
if(encode) if(encode)
return encode; return encode;
infof(data, "\t public key hash: sha256//%s\n", encoded); infof(data, " public key hash: sha256//%s", encoded);
/* it starts with sha256//, copy so we can modify it */ /* it starts with sha256//, copy so we can modify it */
pinkeylen = strlen(pinnedpubkey) + 1; pinkeylen = strlen(pinnedpubkey) + 1;

View File

@ -239,7 +239,7 @@ wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn,
req_method = SSLv23_client_method(); req_method = SSLv23_client_method();
#else #else
infof(data, "wolfSSL <3.3.0 cannot be configured to use TLS 1.0-1.2, " infof(data, "wolfSSL <3.3.0 cannot be configured to use TLS 1.0-1.2, "
"TLS 1.0 is used exclusively\n"); "TLS 1.0 is used exclusively");
req_method = TLSv1_client_method(); req_method = TLSv1_client_method();
#endif #endif
use_sni(TRUE); use_sni(TRUE);
@ -324,7 +324,7 @@ wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn,
failf(data, "failed setting cipher list: %s", ciphers); failf(data, "failed setting cipher list: %s", ciphers);
return CURLE_SSL_CIPHER; return CURLE_SSL_CIPHER;
} }
infof(data, "Cipher selection: %s\n", ciphers); infof(data, "Cipher selection: %s", ciphers);
} }
#ifndef NO_FILESYSTEM #ifndef NO_FILESYSTEM
@ -347,16 +347,16 @@ wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn,
/* Just continue with a warning if no strict certificate /* Just continue with a warning if no strict certificate
verification is required. */ verification is required. */
infof(data, "error setting certificate verify locations," infof(data, "error setting certificate verify locations,"
" continuing anyway:\n"); " continuing anyway:");
} }
} }
else { else {
/* Everything is fine. */ /* Everything is fine. */
infof(data, "successfully set certificate verify locations:\n"); infof(data, "successfully set certificate verify locations:");
} }
infof(data, " CAfile: %s\n", infof(data, " CAfile: %s",
SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile) : "none"); SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile) : "none");
infof(data, " CApath: %s\n", infof(data, " CApath: %s",
SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath) : "none"); SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath) : "none");
} }
@ -406,7 +406,7 @@ wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn,
(wolfSSL_CTX_UseSNI(backend->ctx, WOLFSSL_SNI_HOST_NAME, hostname, (wolfSSL_CTX_UseSNI(backend->ctx, WOLFSSL_SNI_HOST_NAME, hostname,
(unsigned short)hostname_len) != 1)) { (unsigned short)hostname_len) != 1)) {
infof(data, "WARNING: failed to configure server name indication (SNI) " infof(data, "WARNING: failed to configure server name indication (SNI) "
"TLS extension\n"); "TLS extension");
} }
} }
#endif #endif
@ -450,12 +450,12 @@ wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn,
#ifdef USE_HTTP2 #ifdef USE_HTTP2
if(data->state.httpwant >= CURL_HTTP_VERSION_2) { if(data->state.httpwant >= CURL_HTTP_VERSION_2) {
strcpy(protocols + strlen(protocols), ALPN_H2 ","); strcpy(protocols + strlen(protocols), ALPN_H2 ",");
infof(data, "ALPN, offering %s\n", ALPN_H2); infof(data, "ALPN, offering %s", ALPN_H2);
} }
#endif #endif
strcpy(protocols + strlen(protocols), ALPN_HTTP_1_1); strcpy(protocols + strlen(protocols), ALPN_HTTP_1_1);
infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1); infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
if(wolfSSL_UseALPN(backend->handle, protocols, if(wolfSSL_UseALPN(backend->handle, protocols,
(unsigned)strlen(protocols), (unsigned)strlen(protocols),
@ -498,7 +498,7 @@ wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn,
infof(data, "Can't use session ID, going on without\n"); infof(data, "Can't use session ID, going on without\n");
} }
else else
infof(data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID");
} }
Curl_ssl_sessionid_unlock(data); Curl_ssl_sessionid_unlock(data);
} }
@ -578,7 +578,7 @@ wolfssl_connect_step2(struct Curl_easy *data, struct connectdata *conn,
* as also mismatching CN fields */ * as also mismatching CN fields */
else if(DOMAIN_NAME_MISMATCH == detail) { else if(DOMAIN_NAME_MISMATCH == detail) {
#if 1 #if 1
failf(data, "\tsubject alt name(s) or common name do not match \"%s\"", failf(data, " subject alt name(s) or common name do not match \"%s\"",
dispname); dispname);
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
#else #else
@ -590,13 +590,13 @@ wolfssl_connect_step2(struct Curl_easy *data, struct connectdata *conn,
* 'conn->ssl_config.verifyhost' value. */ * 'conn->ssl_config.verifyhost' value. */
if(SSL_CONN_CONFIG(verifyhost)) { if(SSL_CONN_CONFIG(verifyhost)) {
failf(data, failf(data,
"\tsubject alt name(s) or common name do not match \"%s\"\n", " subject alt name(s) or common name do not match \"%s\"\n",
dispname); dispname);
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
else { else {
infof(data, infof(data,
"\tsubject alt name(s) and/or common name do not match \"%s\"\n", " subject alt name(s) and/or common name do not match \"%s\"",
dispname); dispname);
return CURLE_OK; return CURLE_OK;
} }
@ -605,14 +605,14 @@ wolfssl_connect_step2(struct Curl_easy *data, struct connectdata *conn,
#if LIBWOLFSSL_VERSION_HEX >= 0x02007000 /* 2.7.0 */ #if LIBWOLFSSL_VERSION_HEX >= 0x02007000 /* 2.7.0 */
else if(ASN_NO_SIGNER_E == detail) { else if(ASN_NO_SIGNER_E == detail) {
if(SSL_CONN_CONFIG(verifypeer)) { if(SSL_CONN_CONFIG(verifypeer)) {
failf(data, "\tCA signer not available for verification"); failf(data, " CA signer not available for verification");
return CURLE_SSL_CACERT_BADFILE; return CURLE_SSL_CACERT_BADFILE;
} }
else { else {
/* Just continue with a warning if no strict certificate /* Just continue with a warning if no strict certificate
verification is required. */ verification is required. */
infof(data, "CA signer not available for verification, " infof(data, "CA signer not available for verification, "
"continuing anyway\n"); "continuing anyway");
} }
} }
#endif #endif
@ -677,7 +677,7 @@ wolfssl_connect_step2(struct Curl_easy *data, struct connectdata *conn,
rc = wolfSSL_ALPN_GetProtocol(backend->handle, &protocol, &protocol_len); rc = wolfSSL_ALPN_GetProtocol(backend->handle, &protocol, &protocol_len);
if(rc == SSL_SUCCESS) { if(rc == SSL_SUCCESS) {
infof(data, "ALPN, server accepted to use %.*s\n", protocol_len, infof(data, "ALPN, server accepted to use %.*s", protocol_len,
protocol); protocol);
if(protocol_len == ALPN_HTTP_1_1_LENGTH && if(protocol_len == ALPN_HTTP_1_1_LENGTH &&
@ -690,13 +690,13 @@ wolfssl_connect_step2(struct Curl_easy *data, struct connectdata *conn,
conn->negnpn = CURL_HTTP_VERSION_2; conn->negnpn = CURL_HTTP_VERSION_2;
#endif #endif
else else
infof(data, "ALPN, unrecognized protocol %.*s\n", protocol_len, infof(data, "ALPN, unrecognized protocol %.*s", protocol_len,
protocol); protocol);
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ? Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE); BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
} }
else if(rc == SSL_ALPN_NOT_FOUND) else if(rc == SSL_ALPN_NOT_FOUND)
infof(data, "ALPN, server did not agree to a protocol\n"); infof(data, "ALPN, server did not agree to a protocol");
else { else {
failf(data, "ALPN, failure getting protocol, error %d", rc); failf(data, "ALPN, failure getting protocol, error %d", rc);
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
@ -706,11 +706,11 @@ wolfssl_connect_step2(struct Curl_easy *data, struct connectdata *conn,
connssl->connecting_state = ssl_connect_3; connssl->connecting_state = ssl_connect_3;
#if (LIBWOLFSSL_VERSION_HEX >= 0x03009010) #if (LIBWOLFSSL_VERSION_HEX >= 0x03009010)
infof(data, "SSL connection using %s / %s\n", infof(data, "SSL connection using %s / %s",
wolfSSL_get_version(backend->handle), wolfSSL_get_version(backend->handle),
wolfSSL_get_cipher_name(backend->handle)); wolfSSL_get_cipher_name(backend->handle));
#else #else
infof(data, "SSL connected\n"); infof(data, "SSL connected");
#endif #endif
return CURLE_OK; return CURLE_OK;
@ -739,7 +739,7 @@ wolfssl_connect_step3(struct Curl_easy *data, struct connectdata *conn,
&old_ssl_sessionid, NULL, sockindex)); &old_ssl_sessionid, NULL, sockindex));
if(incache) { if(incache) {
if(old_ssl_sessionid != our_ssl_sessionid) { if(old_ssl_sessionid != our_ssl_sessionid) {
infof(data, "old SSL session ID is stale, removing\n"); infof(data, "old SSL session ID is stale, removing");
Curl_ssl_delsessionid(data, old_ssl_sessionid); Curl_ssl_delsessionid(data, old_ssl_sessionid);
incache = FALSE; incache = FALSE;
} }
@ -1089,7 +1089,7 @@ static CURLcode wolfssl_sha256sum(const unsigned char *tmp, /* input */
} }
static void *wolfssl_get_internals(struct ssl_connect_data *connssl, static void *wolfssl_get_internals(struct ssl_connect_data *connssl,
CURLINFO info UNUSED_PARAM) CURLINFO info UNUSED_PARAM)
{ {
struct ssl_backend_data *backend = connssl->backend; struct ssl_backend_data *backend = connssl->backend;
(void)info; (void)info;

View File

@ -866,7 +866,7 @@ static void do_pubkey_field(struct Curl_easy *data, int certnum,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, label, output); Curl_ssl_push_certinfo(data, certnum, label, output);
if(!certnum) if(!certnum)
infof(data, " %s: %s\n", label, output); infof(data, " %s: %s", label, output);
free((char *) output); free((char *) output);
} }
} }
@ -905,7 +905,7 @@ static void do_pubkey(struct Curl_easy *data, int certnum,
if(len > 32) if(len > 32)
elem.beg = q; /* Strip leading zero bytes. */ elem.beg = q; /* Strip leading zero bytes. */
if(!certnum) if(!certnum)
infof(data, " RSA Public Key (%lu bits)\n", len); infof(data, " RSA Public Key (%lu bits)", len);
if(data->set.ssl.certinfo) { if(data->set.ssl.certinfo) {
q = curl_maprintf("%lu", len); q = curl_maprintf("%lu", len);
if(q) { if(q) {
@ -978,7 +978,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Subject", ccp); Curl_ssl_push_certinfo(data, certnum, "Subject", ccp);
if(!certnum) if(!certnum)
infof(data, "%2d Subject: %s\n", certnum, ccp); infof(data, "%2d Subject: %s", certnum, ccp);
free((char *) ccp); free((char *) ccp);
/* Issuer. */ /* Issuer. */
@ -988,7 +988,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Issuer", ccp); Curl_ssl_push_certinfo(data, certnum, "Issuer", ccp);
if(!certnum) if(!certnum)
infof(data, " Issuer: %s\n", ccp); infof(data, " Issuer: %s", ccp);
free((char *) ccp); free((char *) ccp);
/* Version (always fits in less than 32 bits). */ /* Version (always fits in less than 32 bits). */
@ -1003,7 +1003,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
free((char *) ccp); free((char *) ccp);
} }
if(!certnum) if(!certnum)
infof(data, " Version: %lu (0x%lx)\n", version + 1, version); infof(data, " Version: %lu (0x%lx)", version + 1, version);
/* Serial number. */ /* Serial number. */
ccp = ASN1tostr(&cert.serialNumber, 0); ccp = ASN1tostr(&cert.serialNumber, 0);
@ -1012,7 +1012,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Serial Number", ccp); Curl_ssl_push_certinfo(data, certnum, "Serial Number", ccp);
if(!certnum) if(!certnum)
infof(data, " Serial Number: %s\n", ccp); infof(data, " Serial Number: %s", ccp);
free((char *) ccp); free((char *) ccp);
/* Signature algorithm .*/ /* Signature algorithm .*/
@ -1023,7 +1023,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Signature Algorithm", ccp); Curl_ssl_push_certinfo(data, certnum, "Signature Algorithm", ccp);
if(!certnum) if(!certnum)
infof(data, " Signature Algorithm: %s\n", ccp); infof(data, " Signature Algorithm: %s", ccp);
free((char *) ccp); free((char *) ccp);
/* Start Date. */ /* Start Date. */
@ -1033,7 +1033,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Start Date", ccp); Curl_ssl_push_certinfo(data, certnum, "Start Date", ccp);
if(!certnum) if(!certnum)
infof(data, " Start Date: %s\n", ccp); infof(data, " Start Date: %s", ccp);
free((char *) ccp); free((char *) ccp);
/* Expire Date. */ /* Expire Date. */
@ -1043,7 +1043,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Expire Date", ccp); Curl_ssl_push_certinfo(data, certnum, "Expire Date", ccp);
if(!certnum) if(!certnum)
infof(data, " Expire Date: %s\n", ccp); infof(data, " Expire Date: %s", ccp);
free((char *) ccp); free((char *) ccp);
/* Public Key Algorithm. */ /* Public Key Algorithm. */
@ -1054,7 +1054,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Public Key Algorithm", ccp); Curl_ssl_push_certinfo(data, certnum, "Public Key Algorithm", ccp);
if(!certnum) if(!certnum)
infof(data, " Public Key Algorithm: %s\n", ccp); infof(data, " Public Key Algorithm: %s", ccp);
do_pubkey(data, certnum, ccp, &param, &cert.subjectPublicKey); do_pubkey(data, certnum, ccp, &param, &cert.subjectPublicKey);
free((char *) ccp); free((char *) ccp);
@ -1065,7 +1065,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Signature", ccp); Curl_ssl_push_certinfo(data, certnum, "Signature", ccp);
if(!certnum) if(!certnum)
infof(data, " Signature: %s\n", ccp); infof(data, " Signature: %s", ccp);
free((char *) ccp); free((char *) ccp);
/* Generate PEM certificate. */ /* Generate PEM certificate. */
@ -1098,7 +1098,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data,
if(data->set.ssl.certinfo) if(data->set.ssl.certinfo)
Curl_ssl_push_certinfo(data, certnum, "Cert", cp2); Curl_ssl_push_certinfo(data, certnum, "Cert", cp2);
if(!certnum) if(!certnum)
infof(data, "%s\n", cp2); infof(data, "%s", cp2);
free(cp2); free(cp2);
return CURLE_OK; return CURLE_OK;
} }
@ -1220,12 +1220,12 @@ CURLcode Curl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
switch(matched) { switch(matched) {
case 1: case 1:
/* an alternative name matched the server hostname */ /* an alternative name matched the server hostname */
infof(data, "\t subjectAltName: %s matched\n", dispname); infof(data, " subjectAltName: %s matched", dispname);
return CURLE_OK; return CURLE_OK;
case 0: case 0:
/* an alternative name field existed, but didn't match and then /* an alternative name field existed, but didn't match and then
we MUST fail */ we MUST fail */
infof(data, "\t subjectAltName does not match %s\n", dispname); infof(data, " subjectAltName does not match %s", dispname);
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
@ -1262,7 +1262,7 @@ CURLcode Curl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
if(strlen(dnsname) != (size_t) len) /* Nul byte in string ? */ if(strlen(dnsname) != (size_t) len) /* Nul byte in string ? */
failf(data, "SSL: illegal cert name field"); failf(data, "SSL: illegal cert name field");
else if(Curl_cert_hostcheck((const char *) dnsname, hostname)) { else if(Curl_cert_hostcheck((const char *) dnsname, hostname)) {
infof(data, "\t common name: %s (matched)\n", dnsname); infof(data, " common name: %s (matched)", dnsname);
free(dnsname); free(dnsname);
return CURLE_OK; return CURLE_OK;
} }

View File

@ -79,30 +79,39 @@ unit_stop(void)
curl_global_cleanup(); curl_global_cleanup();
} }
static int verify(const char *info, const char *two)
{
/* the 'info' one has a newline appended */
char *nl = strchr(info, '\n');
if(!nl)
return 1; /* nope */
return strncmp(info, two, nl - info);
}
UNITTEST_START UNITTEST_START
/* Injecting a simple short string via a format */ /* Injecting a simple short string via a format */
msnprintf(input, sizeof(input), "Simple Test"); msnprintf(input, sizeof(input), "Simple Test");
Curl_infof(data, "%s", input); Curl_infof(data, "%s", input);
fail_unless(strcmp(result, input) == 0, "Simple string test"); fail_unless(verify(result, input) == 0, "Simple string test");
/* Injecting a few different variables with a format */ /* Injecting a few different variables with a format */
Curl_infof(data, "%s %u testing %lu\n", input, 42, 43L); Curl_infof(data, "%s %u testing %lu", input, 42, 43L);
fail_unless(strcmp(result, "Simple Test 42 testing 43\n") == 0, fail_unless(verify(result, "Simple Test 42 testing 43\n") == 0,
"Format string"); "Format string");
/* Variations of empty strings */ /* Variations of empty strings */
Curl_infof(data, ""); Curl_infof(data, "");
fail_unless(strlen(result) == 0, "Empty string"); fail_unless(strlen(result) == 1, "Empty string");
Curl_infof(data, "%s", NULL); Curl_infof(data, "%s", NULL);
fail_unless(strcmp(result, "(nil)") == 0, "Passing NULL as string"); fail_unless(verify(result, "(nil)") == 0, "Passing NULL as string");
/* A string just long enough to not be truncated */ /* A string just long enough to not be truncated */
memset(input, '\0', sizeof(input)); memset(input, '\0', sizeof(input));
memset(input, 'A', 2048); memset(input, 'A', 2048);
Curl_infof(data, "%s", input); Curl_infof(data, "%s", input);
fail_unless(strlen(result) == 2048, "No truncation of infof input"); fail_unless(strlen(result) == 2048, "No truncation of infof input");
fail_unless(strcmp(result, input) == 0, "No truncation of infof input"); fail_unless(verify(result, input) == 0, "No truncation of infof input");
fail_unless(result[sizeof(result) - 1] == '\0', fail_unless(result[sizeof(result) - 1] == '\0',
"No truncation of infof input"); "No truncation of infof input");
@ -111,25 +120,20 @@ memset(input + 2047, 'A', 4);
Curl_infof(data, "%s", input); Curl_infof(data, "%s", input);
fail_unless(strlen(result) == 2048, "Truncation of infof input 1"); fail_unless(strlen(result) == 2048, "Truncation of infof input 1");
fail_unless(result[sizeof(result) - 1] == '\0', "Truncation of infof input 1"); fail_unless(result[sizeof(result) - 1] == '\0', "Truncation of infof input 1");
fail_unless(strncmp(result + 2045, "...", 3) == 0,
"Truncation of infof input 1");
/* Just over the limit for truncation with newline */ /* Just over the limit for truncation with newline */
memset(input + 2047, 'A', 4); memset(input + 2047, 'A', 4);
memset(input + 2047 + 4, '\n', 1); memset(input + 2047 + 4, '\n', 1);
Curl_infof(data, "%s\n", input); Curl_infof(data, "%s", input);
fail_unless(strlen(result) == 2048, "Truncation of infof input 2"); fail_unless(strlen(result) == 2048, "Truncation of infof input 2");
fail_unless(result[sizeof(result) - 1] == '\0', "Truncation of infof input 2"); fail_unless(result[sizeof(result) - 1] == '\0', "Truncation of infof input 2");
fail_unless(strncmp(result + 2044, "...", 3) == 0,
"Truncation of infof input 2");
/* Way over the limit for truncation with newline */ /* Way over the limit for truncation with newline */
memset(input, '\0', sizeof(input)); memset(input, '\0', sizeof(input));
memset(input, 'A', sizeof(input) - 1); memset(input, 'A', sizeof(input) - 1);
Curl_infof(data, "%s\n", input); Curl_infof(data, "%s", input);
fail_unless(strlen(result) == 2048, "Truncation of infof input 3"); fail_unless(strlen(result) == 2048, "Truncation of infof input 3");
fail_unless(result[sizeof(result) - 1] == '\0', "Truncation of infof input 3"); fail_unless(result[sizeof(result) - 1] == '\0', "Truncation of infof input 3");
fail_unless(strncmp(result + 2044, "...", 3) == 0,
"Truncation of infof input 3");
UNITTEST_STOP UNITTEST_STOP