mirror of
https://github.com/curl/curl.git
synced 2026-08-24 13:33:33 +03: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:
parent
1026b36ea0
commit
e7416cfd2b
69 changed files with 936 additions and 947 deletions
72
lib/http.c
72
lib/http.c
|
|
@ -504,7 +504,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
|
|||
/* rewind data when completely done sending! */
|
||||
if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) {
|
||||
conn->bits.rewindaftersend = TRUE;
|
||||
infof(data, "Rewind stream after send\n");
|
||||
infof(data, "Rewind stream after send");
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
|
|
@ -515,7 +515,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
|
|||
return CURLE_OK;
|
||||
|
||||
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));
|
||||
}
|
||||
#endif
|
||||
|
|
@ -532,7 +532,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
|
|||
/* rewind data when completely done sending! */
|
||||
if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) {
|
||||
conn->bits.rewindaftersend = TRUE;
|
||||
infof(data, "Rewind stream after send\n");
|
||||
infof(data, "Rewind stream after send");
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
|
|
@ -543,7 +543,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
|
|||
return CURLE_OK;
|
||||
|
||||
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));
|
||||
}
|
||||
#endif
|
||||
|
|
@ -756,14 +756,14 @@ output_auth_headers(struct Curl_easy *data,
|
|||
|
||||
if(auth) {
|
||||
#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 ? (data->state.aptr.proxyuser ?
|
||||
data->state.aptr.proxyuser : "") :
|
||||
(data->state.aptr.user ?
|
||||
data->state.aptr.user : ""));
|
||||
#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 ?
|
||||
data->state.aptr.user : "");
|
||||
#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);
|
||||
if(result) {
|
||||
infof(data, "Authentication problem. Ignoring this.\n");
|
||||
infof(data, "Authentication problem. Ignoring this.");
|
||||
data->state.authproblem = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
infof(data, "Authentication problem. Ignoring this.\n");
|
||||
infof(data, "Authentication problem. Ignoring this.");
|
||||
data->state.authproblem = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -1013,7 +1013,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
|
|||
#ifndef CURL_DISABLE_CRYPTO_AUTH
|
||||
if(checkprefix("Digest", auth) && is_valid_auth_separator(auth[6])) {
|
||||
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()) {
|
||||
CURLcode result;
|
||||
|
||||
|
|
@ -1026,7 +1026,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
|
|||
* Digest */
|
||||
result = Curl_input_digest(data, proxy, auth);
|
||||
if(result) {
|
||||
infof(data, "Authentication problem. Ignoring this.\n");
|
||||
infof(data, "Authentication problem. Ignoring this.");
|
||||
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
|
||||
valid. */
|
||||
authp->avail = CURLAUTH_NONE;
|
||||
infof(data, "Authentication problem. Ignoring this.\n");
|
||||
infof(data, "Authentication problem. Ignoring this.");
|
||||
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
|
||||
anyway, which basically means our token isn't valid. */
|
||||
authp->avail = CURLAUTH_NONE;
|
||||
infof(data, "Authentication problem. Ignoring this.\n");
|
||||
infof(data, "Authentication problem. Ignoring this.");
|
||||
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
|
||||
connection properly, we read the full response in "ignore more" */
|
||||
k->ignorebody = TRUE;
|
||||
infof(data, "Ignoring the response-body\n");
|
||||
infof(data, "Ignoring the response-body");
|
||||
}
|
||||
if(data->state.resume_from && !k->content_range &&
|
||||
(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
|
||||
what should have been returned from the server */
|
||||
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
|
||||
re-use ability. Close the connection */
|
||||
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) {
|
||||
/* We don't support HTTP/2 proxies yet. Also it's debatable
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
DEBUGF(infof(data, "HTTP/2 over clean TCP\n"));
|
||||
DEBUGF(infof(data, "HTTP/2 over clean TCP"));
|
||||
conn->httpversion = 20;
|
||||
|
||||
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
|
||||
complete */
|
||||
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.upload_done = TRUE;
|
||||
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;
|
||||
}
|
||||
streamclose(conn, "overflow content-length");
|
||||
infof(data, "Overflow Content-Length: value!\n");
|
||||
infof(data, "Overflow Content-Length: value!");
|
||||
}
|
||||
else {
|
||||
/* 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.
|
||||
*/
|
||||
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) &&
|
||||
conn->bits.httpproxy &&
|
||||
|
|
@ -3460,7 +3460,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
|
|||
* close down after this transfer.
|
||||
*/
|
||||
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
|
||||
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] */
|
||||
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")) {
|
||||
/*
|
||||
|
|
@ -3653,10 +3653,10 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
|
|||
Curl_hsts_parse(data->hsts, data->state.up.hostname,
|
||||
headp + strlen("Strict-Transport-Security:"));
|
||||
if(check)
|
||||
infof(data, "Illegal STS header skipped\n");
|
||||
infof(data, "Illegal STS header skipped");
|
||||
#ifdef DEBUGBUILD
|
||||
else
|
||||
infof(data, "Parsed STS header fine (%zu entries)\n",
|
||||
infof(data, "Parsed STS header fine (%zu entries)",
|
||||
data->hsts->list.size);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -3726,12 +3726,12 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
|
|||
/* Default action for HTTP/1.0 must be to close, unless
|
||||
we get one of those fancy headers that tell us the
|
||||
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");
|
||||
}
|
||||
else if(conn->httpversion == 20 ||
|
||||
(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
|
||||
of the protocol */
|
||||
conn->bundle->multiuse = BUNDLE_MULTIPLEX;
|
||||
|
|
@ -3740,7 +3740,7 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
|
|||
!conn->bits.close) {
|
||||
/* If HTTP version is >= 1.1 and connection is persistent */
|
||||
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;
|
||||
|
|
@ -3918,7 +3918,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
/* Switching Protocols */
|
||||
if(k->upgr101 == UPGR101_REQUESTED) {
|
||||
/* Switching to HTTP/2 */
|
||||
infof(data, "Received 101\n");
|
||||
infof(data, "Received 101");
|
||||
k->upgr101 = UPGR101_RECEIVED;
|
||||
|
||||
/* 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
|
||||
signal the end of the document. */
|
||||
infof(data, "no chunk, no close, no size. Assume close to "
|
||||
"signal end\n");
|
||||
"signal end");
|
||||
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)) ||
|
||||
((data->req.httpcode == 407) &&
|
||||
(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;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -3981,7 +3981,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
(conn->http_negotiate_state == GSS_AUTHRECV)) ||
|
||||
((data->req.httpcode == 407) &&
|
||||
(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;
|
||||
}
|
||||
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) {
|
||||
/* 417 Expectation Failed - try again without the Expect
|
||||
header */
|
||||
infof(data, "Got 417 while waiting for a 100\n");
|
||||
infof(data, "Got 417 while waiting for a 100");
|
||||
data->state.disableexpect = TRUE;
|
||||
DEBUGASSERT(!data->req.newurl);
|
||||
data->req.newurl = strdup(data->state.url);
|
||||
Curl_done_sending(data, k);
|
||||
}
|
||||
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) {
|
||||
k->exp100 = EXP100_SEND_DATA;
|
||||
k->keepon |= KEEP_SEND;
|
||||
}
|
||||
}
|
||||
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");
|
||||
result = Curl_done_sending(data, k);
|
||||
if(result)
|
||||
|
|
@ -4095,7 +4095,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
if(conn->bits.rewindaftersend) {
|
||||
/* We rewind after a complete send, so thus we continue
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -4250,11 +4250,11 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
if(k->upgr101 == UPGR101_RECEIVED) {
|
||||
/* supposedly upgraded to http2 now */
|
||||
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) {
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue