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

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