mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 12:05:06 -05:00
Here's an effort to avoid saying 'data not shown' in the debug parts when the
data is actually shown on screen. Like when you do 'curl -v host' with data and debug info sent to the same terminal.
This commit is contained in:
parent
83884180ac
commit
5c3dc49f44
32
src/main.c
32
src/main.c
@ -165,6 +165,7 @@ typedef enum {
|
||||
#define CONF_DEFAULT 0
|
||||
#endif
|
||||
|
||||
#define CONF_ISATTY (1<<0) /* output to tty! */
|
||||
#define CONF_AUTO_REFERER (1<<4) /* the automatic referer-system please! */
|
||||
#define CONF_HEADER (1<<8) /* throw the header out too */
|
||||
#define CONF_NOPROGRESS (1<<10) /* shut off the progress meter */
|
||||
@ -240,6 +241,14 @@ typedef enum {
|
||||
TRACE_PLAIN /* -v/--verbose type */
|
||||
} trace;
|
||||
|
||||
struct OutStruct {
|
||||
char *filename;
|
||||
FILE *stream;
|
||||
struct Configurable *config;
|
||||
curl_off_t bytes; /* amount written so far */
|
||||
curl_off_t init; /* original size (non-zero when appending) */
|
||||
};
|
||||
|
||||
struct Configurable {
|
||||
bool remote_time;
|
||||
char *random_file;
|
||||
@ -355,6 +364,8 @@ struct Configurable {
|
||||
|
||||
bool ignorecl; /* --ignore-content-length */
|
||||
bool disable_sessionid;
|
||||
|
||||
struct OutStruct *outs;
|
||||
};
|
||||
|
||||
#define WARN_PREFIX "Warning: "
|
||||
@ -2243,6 +2254,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
checkpasswd("proxy", &config->proxyuserpwd);
|
||||
break;
|
||||
case 'v':
|
||||
/* the '%' thing here will cause the trace get sent to stderr */
|
||||
GetStr(&config->trace_dump, (char *)"%");
|
||||
config->tracetype = TRACE_PLAIN;
|
||||
break;
|
||||
@ -2621,14 +2633,6 @@ static void go_sleep(long ms)
|
||||
#endif
|
||||
}
|
||||
|
||||
struct OutStruct {
|
||||
char *filename;
|
||||
FILE *stream;
|
||||
struct Configurable *config;
|
||||
curl_off_t bytes; /* amount written so far */
|
||||
curl_off_t init; /* original size (non-zero when appending) */
|
||||
};
|
||||
|
||||
static size_t my_fwrite(void *buffer, size_t sz, size_t nmemb, void *stream)
|
||||
{
|
||||
size_t rc;
|
||||
@ -3027,12 +3031,20 @@ int my_trace(CURL *handle, curl_infotype type,
|
||||
case CURLINFO_SSL_DATA_IN:
|
||||
case CURLINFO_SSL_DATA_OUT:
|
||||
if(!traced_data) {
|
||||
/* if the data is output to a tty and we're sending this debug trace
|
||||
to stderr or stdout, we don't display the alert about the data not
|
||||
being shown as the data _is_ shown then just not via this
|
||||
function */
|
||||
if(!(config->conf&CONF_ISATTY) ||
|
||||
((config->trace_stream != stderr) &&
|
||||
(config->trace_stream != stdout))) {
|
||||
if(!newl)
|
||||
fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
|
||||
fprintf(config->trace_stream, "[data not shown]\n");
|
||||
newl = FALSE;
|
||||
traced_data = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: /* nada */
|
||||
newl = FALSE;
|
||||
@ -3241,6 +3253,8 @@ operate(struct Configurable *config, int argc, char *argv[])
|
||||
|
||||
memset(&outs,0,sizeof(outs));
|
||||
|
||||
config->outs = &outs;
|
||||
|
||||
/* we get libcurl info right away */
|
||||
curlinfo = curl_version_info(CURLVERSION_NOW);
|
||||
|
||||
@ -3691,7 +3705,7 @@ operate(struct Configurable *config, int argc, char *argv[])
|
||||
&& outs.stream && isatty(fileno(outs.stream)))
|
||||
/* we send the output to a tty, therefore we switch off the progress
|
||||
meter */
|
||||
config->conf |= CONF_NOPROGRESS;
|
||||
config->conf |= CONF_NOPROGRESS|CONF_ISATTY;
|
||||
|
||||
if (urlnum > 1 && !(config->conf&CONF_MUTE)) {
|
||||
fprintf(stderr, "\n[%d/%d]: %s --> %s\n",
|
||||
|
Loading…
Reference in New Issue
Block a user