mirror of
https://github.com/curl/curl.git
synced 2025-04-18 16:30:45 +08:00
Curl_debug: remove dead printhost code
The struct field is never set (since 5e0d9aea3) so remove the use of it and remove the connectdata pointer from the prototype. Reported-by: Tejas Bug: https://curl.haxx.se/mail/lib-2018-06/0054.html Closes #2647
This commit is contained in:
parent
819f44dc07
commit
5ae22272d1
@ -3991,8 +3991,7 @@ CURLcode Curl_ftpsend(struct connectdata *conn, const char *cmd)
|
||||
break;
|
||||
|
||||
if(conn->data->set.verbose)
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT,
|
||||
sptr, (size_t)bytes_written, conn);
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT, sptr, (size_t)bytes_written);
|
||||
|
||||
if(bytes_written != (ssize_t)write_len) {
|
||||
write_len -= bytes_written;
|
||||
|
@ -1181,12 +1181,12 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
|
||||
|
||||
if(conn->data->set.verbose) {
|
||||
/* this data _may_ contain binary stuff */
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, headlen, conn);
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, headlen);
|
||||
if(bodylen) {
|
||||
/* there was body data sent beyond the initial header part, pass that
|
||||
on to the debug callback too */
|
||||
Curl_debug(conn->data, CURLINFO_DATA_OUT,
|
||||
ptr + headlen, bodylen, conn);
|
||||
ptr + headlen, bodylen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3405,7 +3405,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
||||
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
k->str_start, headerlen, conn);
|
||||
k->str_start, headerlen);
|
||||
break; /* exit header line loop */
|
||||
}
|
||||
|
||||
@ -3860,8 +3860,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
||||
writetype |= CLIENTWRITE_BODY;
|
||||
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
k->p, (size_t)k->hbuflen, conn);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, k->p, (size_t)k->hbuflen);
|
||||
|
||||
result = Curl_client_write(conn, writetype, k->p, k->hbuflen);
|
||||
if(result)
|
||||
|
@ -419,7 +419,7 @@ static CURLcode CONNECT(struct connectdata *conn,
|
||||
/* output debug if that is requested */
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
s->line_start, (size_t)s->perline, conn);
|
||||
s->line_start, (size_t)s->perline);
|
||||
|
||||
if(!data->set.suppress_connect_headers) {
|
||||
/* send the header to the callback */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -221,8 +221,7 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp,
|
||||
}
|
||||
|
||||
if(conn->data->set.verbose)
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT,
|
||||
s, (size_t)bytes_written, conn);
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT, s, (size_t)bytes_written);
|
||||
|
||||
if(bytes_written != (ssize_t)write_len) {
|
||||
/* the whole chunk was not sent, keep it around and adjust sizes */
|
||||
@ -370,7 +369,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
|
||||
#endif
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
pp->linestart_resp, (size_t)perline, conn);
|
||||
pp->linestart_resp, (size_t)perline);
|
||||
|
||||
/*
|
||||
* We pass all response-lines to the callback function registered
|
||||
|
@ -390,7 +390,7 @@ int Curl_sec_read_msg(struct connectdata *conn, char *buffer,
|
||||
|
||||
if(conn->data->set.verbose) {
|
||||
buf[decoded_len] = '\n';
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1, conn);
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1);
|
||||
}
|
||||
|
||||
buf[decoded_len] = '\0';
|
||||
|
48
lib/sendf.c
48
lib/sendf.c
@ -240,7 +240,7 @@ void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
|
||||
vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap);
|
||||
va_end(ap);
|
||||
len = strlen(print_buffer);
|
||||
Curl_debug(data, CURLINFO_TEXT, print_buffer, len, NULL);
|
||||
Curl_debug(data, CURLINFO_TEXT, print_buffer, len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
|
||||
if(data->set.verbose) {
|
||||
error[len] = '\n';
|
||||
error[++len] = '\0';
|
||||
Curl_debug(data, CURLINFO_TEXT, error, len, NULL);
|
||||
Curl_debug(data, CURLINFO_TEXT, error, len);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
@ -300,7 +300,7 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn,
|
||||
break;
|
||||
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written, conn);
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written);
|
||||
|
||||
if((size_t)bytes_written != write_len) {
|
||||
/* if not all was written at once, we must advance the pointer, decrease
|
||||
@ -762,8 +762,8 @@ CURLcode Curl_read(struct connectdata *conn, /* connection data */
|
||||
}
|
||||
|
||||
/* return 0 on success */
|
||||
static int showit(struct Curl_easy *data, curl_infotype type,
|
||||
char *ptr, size_t size)
|
||||
int Curl_debug(struct Curl_easy *data, curl_infotype type,
|
||||
char *ptr, size_t size)
|
||||
{
|
||||
static const char s_infotype[CURLINFO_END][3] = {
|
||||
"* ", "< ", "> ", "{ ", "} ", "{ ", "} " };
|
||||
@ -834,41 +834,3 @@ static int showit(struct Curl_easy *data, curl_infotype type,
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
int Curl_debug(struct Curl_easy *data, curl_infotype type,
|
||||
char *ptr, size_t size,
|
||||
struct connectdata *conn)
|
||||
{
|
||||
int rc;
|
||||
if(data->set.printhost && conn && conn->host.dispname) {
|
||||
const char *t = NULL;
|
||||
const char *w = "Data";
|
||||
switch(type) {
|
||||
case CURLINFO_HEADER_IN:
|
||||
w = "Header";
|
||||
/* FALLTHROUGH */
|
||||
case CURLINFO_DATA_IN:
|
||||
t = "from";
|
||||
break;
|
||||
case CURLINFO_HEADER_OUT:
|
||||
w = "Header";
|
||||
/* FALLTHROUGH */
|
||||
case CURLINFO_DATA_OUT:
|
||||
t = "to";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(t) {
|
||||
char buffer[160];
|
||||
snprintf(buffer, sizeof(buffer), "[%s %s %s]", w, t,
|
||||
conn->host.dispname);
|
||||
rc = showit(data, CURLINFO_TEXT, buffer, strlen(buffer));
|
||||
if(rc)
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
rc = showit(data, type, ptr, size);
|
||||
return rc;
|
||||
}
|
||||
|
@ -85,8 +85,7 @@ CURLcode Curl_write_plain(struct connectdata *conn,
|
||||
|
||||
/* the function used to output verbose information */
|
||||
int Curl_debug(struct Curl_easy *data, curl_infotype type,
|
||||
char *ptr, size_t size,
|
||||
struct connectdata *conn);
|
||||
char *ptr, size_t size);
|
||||
|
||||
|
||||
#endif /* HEADER_CURL_SENDF_H */
|
||||
|
@ -1306,7 +1306,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
if(data->set.verbose) {
|
||||
Curl_debug(data, CURLINFO_DATA_OUT,
|
||||
(char *)sshc->readdir_filename,
|
||||
sshc->readdir_len, conn);
|
||||
sshc->readdir_len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1423,7 +1423,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
/* output debug output if that is requested */
|
||||
if(data->set.verbose) {
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line,
|
||||
sshc->readdir_currLen, conn);
|
||||
sshc->readdir_currLen);
|
||||
}
|
||||
data->req.bytecount += sshc->readdir_currLen;
|
||||
}
|
||||
@ -2500,8 +2500,8 @@ static void sftp_quote(struct connectdata *conn)
|
||||
return;
|
||||
}
|
||||
if(data->set.verbose) {
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, (char *) "PWD\n", 4, conn);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp), conn);
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, (char *) "PWD\n", 4);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
|
||||
}
|
||||
/* this sends an FTP-like "header" to the header callback so that the
|
||||
current directory can be read very similar to how it is read when
|
||||
|
@ -1175,8 +1175,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
break;
|
||||
}
|
||||
if(data->set.verbose) {
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"PWD\n", 4, conn);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp), conn);
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"PWD\n", 4);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
|
||||
}
|
||||
/* this sends an FTP-like "header" to the header callback so that the
|
||||
current directory can be read very similar to how it is read when
|
||||
@ -1970,7 +1970,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
/* output debug output if that is requested */
|
||||
if(data->set.verbose) {
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_filename,
|
||||
sshc->readdir_len, conn);
|
||||
sshc->readdir_len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -2079,7 +2079,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
/* output debug output if that is requested */
|
||||
if(data->set.verbose) {
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line,
|
||||
sshc->readdir_currLen, conn);
|
||||
sshc->readdir_currLen);
|
||||
}
|
||||
data->req.bytecount += sshc->readdir_currLen;
|
||||
}
|
||||
|
@ -660,14 +660,14 @@ static CURLcode readwrite_data(struct Curl_easy *data,
|
||||
if(data->set.verbose) {
|
||||
if(k->badheader) {
|
||||
Curl_debug(data, CURLINFO_DATA_IN, data->state.headerbuff,
|
||||
(size_t)k->hbuflen, conn);
|
||||
(size_t)k->hbuflen);
|
||||
if(k->badheader == HEADER_PARTHEADER)
|
||||
Curl_debug(data, CURLINFO_DATA_IN,
|
||||
k->str, (size_t)nread, conn);
|
||||
k->str, (size_t)nread);
|
||||
}
|
||||
else
|
||||
Curl_debug(data, CURLINFO_DATA_IN,
|
||||
k->str, (size_t)nread, conn);
|
||||
k->str, (size_t)nread);
|
||||
}
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
@ -1027,7 +1027,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
|
||||
if(data->set.verbose)
|
||||
/* show the data before we change the pointer upload_fromhere */
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, k->upload_fromhere,
|
||||
(size_t)bytes_written, conn);
|
||||
(size_t)bytes_written);
|
||||
|
||||
k->writebytecount += bytes_written;
|
||||
|
||||
|
@ -1585,8 +1585,6 @@ struct UserDefined {
|
||||
/* Here follows boolean settings that define how to behave during
|
||||
this session. They are STATIC, set by libcurl users or at least initially
|
||||
and they don't change during operations. */
|
||||
|
||||
bool printhost; /* printing host name in debug info */
|
||||
bool get_filetime; /* get the time and get of the remote file */
|
||||
bool tunnel_thru_httpproxy; /* use CONNECT through a HTTP proxy */
|
||||
bool prefer_ascii; /* ASCII rather than binary */
|
||||
|
@ -1945,12 +1945,12 @@ static void ssl_tls_trace(int direction, int ssl_ver, int content_type,
|
||||
verstr, direction?"OUT":"IN",
|
||||
tls_rt_name, msg_name, msg_type);
|
||||
if(0 <= txt_len && (unsigned)txt_len < sizeof(ssl_buf)) {
|
||||
Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len, NULL);
|
||||
Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len);
|
||||
}
|
||||
}
|
||||
|
||||
Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT :
|
||||
CURLINFO_SSL_DATA_IN, (char *)buf, len, NULL);
|
||||
CURLINFO_SSL_DATA_IN, (char *)buf, len);
|
||||
(void) ssl;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user