if(config->trace_stream)
output = config->trace_stream;
+ if(!output) {
+ warnf(config, "Failed to create/open output");
+ return 0;
+ }
+
if(config->tracetype == TRACE_PLAIN) {
/*
* This is the trace look that is similar to what libcurl makes on its
for(i=0; i<size-1; i++) {
if(data[i] == '\n') { /* LF */
if(!newl) {
- fprintf(config->trace_stream, "%s%s ",
- timebuf, s_infotype[type]);
+ fprintf(output, "%s%s ", timebuf, s_infotype[type]);
}
- fwrite(data+st, i-st+1, 1, config->trace_stream);
+ fwrite(data+st, i-st+1, 1, output);
st = i+1;
newl = FALSE;
}
}
if(!newl)
- fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
- fwrite(data+st, i-st+1, 1, config->trace_stream);
+ fprintf(output, "%s%s ", timebuf, s_infotype[type]);
+ fwrite(data+st, i-st+1, 1, output);
newl = (bool)(size && (data[size-1] != '\n'));
traced_data = FALSE;
break;
case CURLINFO_TEXT:
case CURLINFO_HEADER_IN:
if(!newl)
- fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
- fwrite(data, size, 1, config->trace_stream);
+ fprintf(output, "%s%s ", timebuf, s_infotype[type]);
+ fwrite(data, size, 1, output);
newl = (bool)(size && (data[size-1] != '\n'));
traced_data = FALSE;
break;
being shown as the data _is_ shown then just not via this
function */
if(!config->isatty ||
- ((config->trace_stream != stderr) &&
- (config->trace_stream != stdout))) {
+ ((output != stderr) && (output != stdout))) {
if(!newl)
- fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
- fprintf(config->trace_stream, "[data not shown]\n");
+ fprintf(output, "%s%s ", timebuf, s_infotype[type]);
+ fprintf(output, "[data not shown]\n");
newl = FALSE;
traced_data = TRUE;
}