mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
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:
parent
86f93a53d6
commit
5ccbbe40c2
7
CHANGES
7
CHANGES
@ -6,6 +6,13 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Dan F (13 October 2006)
|
||||||
|
- 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.
|
||||||
|
|
||||||
Daniel (12 October 2006)
|
Daniel (12 October 2006)
|
||||||
- Starting now, adding an easy handle to a multi stack that was already added
|
- Starting now, adding an easy handle to a multi stack that was already added
|
||||||
to a multi stack will cause CURLM_BAD_EASY_HANDLE to get returned.
|
to a multi stack will cause CURLM_BAD_EASY_HANDLE to get returned.
|
||||||
|
@ -47,6 +47,8 @@ This release includes the following bugfixes:
|
|||||||
o (HTTP) Expect: header disabling work better
|
o (HTTP) Expect: header disabling work better
|
||||||
o (HTTP) "Expect: 100-continue" disable on second POST on re-used connection
|
o (HTTP) "Expect: 100-continue" disable on second POST on re-used connection
|
||||||
o src/config.h.in is fixed
|
o src/config.h.in is fixed
|
||||||
|
o (HTTP) POST data logged to the debug callback function is now correctly
|
||||||
|
tagged as data, not header
|
||||||
|
|
||||||
Other curl-related news:
|
Other curl-related news:
|
||||||
|
|
||||||
@ -66,6 +68,6 @@ advice from friends like these:
|
|||||||
Domenico Andreoli, Armel Asselin, Gisle Vanem, Yang Tse, Andrew Biggs,
|
Domenico Andreoli, Armel Asselin, Gisle Vanem, Yang Tse, Andrew Biggs,
|
||||||
Peter Sylvester, David McCreedy, Dmitriy Sergeyev, Dmitry Rechkin,
|
Peter Sylvester, David McCreedy, Dmitriy Sergeyev, Dmitry Rechkin,
|
||||||
Jari Sundell, Ravi Pratap, Michele Bini, Jeff Pohlmeyer, Michael Wallner,
|
Jari Sundell, Ravi Pratap, Michele Bini, Jeff Pohlmeyer, Michael Wallner,
|
||||||
Mike Protts, Cory Nelson, Bernard Leak, Bogdan Nicula
|
Mike Protts, Cory Nelson, Bernard Leak, Bogdan Nicula, Dan Fandrich
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
40
lib/http.c
40
lib/http.c
@ -573,11 +573,11 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
|
|||||||
start++;
|
start++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here we check if we want the specific single authentiction (using ==) and
|
* Here we check if we want the specific single authentication (using ==) and
|
||||||
* if we do, we initiate usage of it.
|
* if we do, we initiate usage of it.
|
||||||
*
|
*
|
||||||
* If the provided authentication is wanted as one out of several accepted
|
* If the provided authentication is wanted as one out of several accepted
|
||||||
* types (using &), we OR this authenticaion type to the authavail
|
* types (using &), we OR this authentication type to the authavail
|
||||||
* variable.
|
* variable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -840,7 +840,8 @@ send_buffer *add_buffer_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add_buffer_send() sends a buffer and frees all associated memory.
|
* add_buffer_send() sends a header buffer and frees all associated memory.
|
||||||
|
* Body data may be appended to the header data if desired.
|
||||||
*
|
*
|
||||||
* Returns CURLcode
|
* Returns CURLcode
|
||||||
*/
|
*/
|
||||||
@ -849,7 +850,10 @@ CURLcode add_buffer_send(send_buffer *in,
|
|||||||
struct connectdata *conn,
|
struct connectdata *conn,
|
||||||
long *bytes_written, /* add the number of sent
|
long *bytes_written, /* add the number of sent
|
||||||
bytes to this counter */
|
bytes to this counter */
|
||||||
|
int included_body_bytes, /* how much of the buffer
|
||||||
|
contains body data (for log tracing) */
|
||||||
int socketindex)
|
int socketindex)
|
||||||
|
|
||||||
{
|
{
|
||||||
ssize_t amount;
|
ssize_t amount;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
@ -894,9 +898,14 @@ CURLcode add_buffer_send(send_buffer *in,
|
|||||||
|
|
||||||
if(CURLE_OK == res) {
|
if(CURLE_OK == res) {
|
||||||
|
|
||||||
if(conn->data->set.verbose)
|
if(conn->data->set.verbose) {
|
||||||
/* this data _may_ contain binary stuff */
|
/* this data _may_ contain binary stuff */
|
||||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, amount, conn);
|
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr,
|
||||||
|
amount-included_body_bytes, conn);
|
||||||
|
if (included_body_bytes)
|
||||||
|
Curl_debug(conn->data, CURLINFO_DATA_OUT,
|
||||||
|
ptr+amount-included_body_bytes, included_body_bytes, conn);
|
||||||
|
}
|
||||||
|
|
||||||
*bytes_written += amount;
|
*bytes_written += amount;
|
||||||
|
|
||||||
@ -1173,7 +1182,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
if(CURLE_OK == result)
|
if(CURLE_OK == result)
|
||||||
/* Now send off the request */
|
/* Now send off the request */
|
||||||
result = add_buffer_send(req_buffer, conn,
|
result = add_buffer_send(req_buffer, conn,
|
||||||
&data->info.request_size, sockindex);
|
&data->info.request_size, 0, sockindex);
|
||||||
}
|
}
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending CONNECT to proxy");
|
failf(data, "Failed sending CONNECT to proxy");
|
||||||
@ -1360,7 +1369,7 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
|
|||||||
/* If we are not using a proxy and we want a secure connection, perform SSL
|
/* If we are not using a proxy and we want a secure connection, perform SSL
|
||||||
* initialization & connection now. If using a proxy with https, then we
|
* initialization & connection now. If using a proxy with https, then we
|
||||||
* must tell the proxy to CONNECT to the host we want to talk to. Only
|
* must tell the proxy to CONNECT to the host we want to talk to. Only
|
||||||
* after the connect has occured, can we start talking SSL
|
* after the connect has occurred, can we start talking SSL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
|
if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
|
||||||
@ -1594,6 +1603,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
char *request;
|
char *request;
|
||||||
Curl_HttpReq httpreq = data->set.httpreq;
|
Curl_HttpReq httpreq = data->set.httpreq;
|
||||||
char *addcookies = NULL;
|
char *addcookies = NULL;
|
||||||
|
int included_body = 0;
|
||||||
|
|
||||||
/* Always consider the DO phase done after this function call, even if there
|
/* Always consider the DO phase done after this function call, even if there
|
||||||
may be parts of the request that is not yet sent, since we can deal with
|
may be parts of the request that is not yet sent, since we can deal with
|
||||||
@ -1612,7 +1622,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
else
|
else
|
||||||
http = data->reqdata.proto.http;
|
http = data->reqdata.proto.http;
|
||||||
|
|
||||||
/* We default to persistant connections */
|
/* We default to persistent connections */
|
||||||
conn->bits.close = FALSE;
|
conn->bits.close = FALSE;
|
||||||
|
|
||||||
if ( (conn->protocol&(PROT_HTTP|PROT_FTP)) &&
|
if ( (conn->protocol&(PROT_HTTP|PROT_FTP)) &&
|
||||||
@ -2096,7 +2106,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = add_buffer_send(req_buffer, conn,
|
result = add_buffer_send(req_buffer, conn,
|
||||||
&data->info.request_size, FIRSTSOCKET);
|
&data->info.request_size, 0, FIRSTSOCKET);
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending POST request");
|
failf(data, "Failed sending POST request");
|
||||||
else
|
else
|
||||||
@ -2159,7 +2169,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
/* fire away the whole request to the server */
|
/* fire away the whole request to the server */
|
||||||
result = add_buffer_send(req_buffer, conn,
|
result = add_buffer_send(req_buffer, conn,
|
||||||
&data->info.request_size, FIRSTSOCKET);
|
&data->info.request_size, 0, FIRSTSOCKET);
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending POST request");
|
failf(data, "Failed sending POST request");
|
||||||
else
|
else
|
||||||
@ -2203,7 +2213,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
/* this sends the buffer and frees all the buffer resources */
|
/* this sends the buffer and frees all the buffer resources */
|
||||||
result = add_buffer_send(req_buffer, conn,
|
result = add_buffer_send(req_buffer, conn,
|
||||||
&data->info.request_size, FIRSTSOCKET);
|
&data->info.request_size, 0, FIRSTSOCKET);
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending PUT request");
|
failf(data, "Failed sending PUT request");
|
||||||
else
|
else
|
||||||
@ -2280,6 +2290,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
already now to reduce the number if send() calls */
|
already now to reduce the number if send() calls */
|
||||||
result = add_buffer(req_buffer, data->set.postfields,
|
result = add_buffer(req_buffer, data->set.postfields,
|
||||||
(size_t)postsize);
|
(size_t)postsize);
|
||||||
|
included_body = postsize;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Append the POST data chunky-style */
|
/* Append the POST data chunky-style */
|
||||||
@ -2291,6 +2302,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
result = add_buffer(req_buffer,
|
result = add_buffer(req_buffer,
|
||||||
"\r\n0\r\n\r\n", 7); /* end of a chunked
|
"\r\n0\r\n\r\n", 7); /* end of a chunked
|
||||||
transfer stream */
|
transfer stream */
|
||||||
|
included_body = postsize + 7;
|
||||||
}
|
}
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
@ -2324,8 +2336,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* issue the request */
|
/* issue the request */
|
||||||
result = add_buffer_send(req_buffer, conn,
|
result = add_buffer_send(req_buffer, conn, &data->info.request_size,
|
||||||
&data->info.request_size, FIRSTSOCKET);
|
included_body, FIRSTSOCKET);
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending HTTP POST request");
|
failf(data, "Failed sending HTTP POST request");
|
||||||
@ -2342,7 +2354,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
/* issue the request */
|
/* issue the request */
|
||||||
result = add_buffer_send(req_buffer, conn,
|
result = add_buffer_send(req_buffer, conn,
|
||||||
&data->info.request_size, FIRSTSOCKET);
|
&data->info.request_size, 0, FIRSTSOCKET);
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending HTTP request");
|
failf(data, "Failed sending HTTP request");
|
||||||
|
22
src/main.c
22
src/main.c
@ -2986,11 +2986,12 @@ int my_trace(CURL *handle, curl_infotype type,
|
|||||||
* own.
|
* own.
|
||||||
*/
|
*/
|
||||||
static const char * const s_infotype[] = {
|
static const char * const s_infotype[] = {
|
||||||
"*", "<", ">"
|
"*", "<", ">", "{", "}", "{", "}"
|
||||||
};
|
};
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t st=0;
|
size_t st=0;
|
||||||
static bool newl = FALSE;
|
static bool newl = FALSE;
|
||||||
|
static bool traced_data = FALSE;
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case CURLINFO_HEADER_OUT:
|
case CURLINFO_HEADER_OUT:
|
||||||
@ -3008,20 +3009,35 @@ int my_trace(CURL *handle, curl_infotype type,
|
|||||||
if(!newl)
|
if(!newl)
|
||||||
fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
|
fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
|
||||||
fwrite(data+st, i-st+1, 1, config->trace_stream);
|
fwrite(data+st, i-st+1, 1, config->trace_stream);
|
||||||
|
newl = (bool)(size && (data[size-1] != '\n'));
|
||||||
|
traced_data = FALSE;
|
||||||
break;
|
break;
|
||||||
case CURLINFO_TEXT:
|
case CURLINFO_TEXT:
|
||||||
case CURLINFO_HEADER_IN:
|
case CURLINFO_HEADER_IN:
|
||||||
if(!newl)
|
if(!newl)
|
||||||
fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
|
fprintf(config->trace_stream, "%s%s ", timebuf, s_infotype[type]);
|
||||||
fwrite(data, size, 1, config->trace_stream);
|
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;
|
break;
|
||||||
default: /* nada */
|
default: /* nada */
|
||||||
newl = FALSE;
|
newl = FALSE;
|
||||||
|
traced_data = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
newl = (bool)(size && (data[size-1] != '\n'));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user