The tagging of application/x-www-form-urlencoded POST body data sent

to the CURLOPT_DEBUGFUNCTION callback has been fixed (it was erroneously
included as part of the header).  A message was also added to the
command line tool to show when data is being sent, enabled when
--verbose is used.
This commit is contained in:
Dan Fandrich 2006-10-13 21:02:27 +00:00
parent 86f93a53d6
commit 5ccbbe40c2
4 changed files with 55 additions and 18 deletions

View file

@ -2986,11 +2986,12 @@ int my_trace(CURL *handle, curl_infotype type,
* own.
*/
static const char * const s_infotype[] = {
"*", "<", ">"
"*", "<", ">", "{", "}", "{", "}"
};
size_t i;
size_t st=0;
static bool newl = FALSE;
static bool traced_data = FALSE;
switch(type) {
case CURLINFO_HEADER_OUT:
@ -3008,20 +3009,35 @@ int my_trace(CURL *handle, curl_infotype type,
if(!newl)
fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
fwrite(data+st, i-st+1, 1, config->trace_stream);
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);
newl = (bool)(size && (data[size-1] != '\n'));
traced_data = FALSE;
break;
case CURLINFO_DATA_OUT:
case CURLINFO_DATA_IN:
case CURLINFO_SSL_DATA_IN:
case CURLINFO_SSL_DATA_OUT:
if(!traced_data) {
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;
traced_data = FALSE;
break;
}
newl = (bool)(size && (data[size-1] != '\n'));
return 0;
}