From 86cc34c0de18a159fcebde42d59f9d94a68bfac6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 3 May 2002 12:07:32 +0000 Subject: [PATCH] made the DEBUGFUNCTION get called properly on a few more places, especially for DATA_IN and DATA_OUT. --- lib/transfer.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/transfer.c b/lib/transfer.c index 3e10047634..a861e95e7a 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -294,6 +294,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, *****/ if (('\n' == *k->p) || ('\r' == *k->p)) { + int headerlen; /* Zero-length header line means end of headers! */ if ('\r' == *k->p) @@ -341,14 +342,16 @@ CURLcode Curl_readwrite(struct connectdata *conn, if (data->set.http_include_header) k->writetype |= CLIENTWRITE_BODY; + headerlen = k->p - data->state.headerbuff; + result = Curl_client_write(data, k->writetype, data->state.headerbuff, - k->p - data->state.headerbuff); + headerlen); if(result) return result; - data->info.header_size += k->p - data->state.headerbuff; - conn->headerbytecount += k->p - data->state.headerbuff; + data->info.header_size += headerlen; + conn->headerbytecount += headerlen; if(!k->header) { /* @@ -591,6 +594,10 @@ CURLcode Curl_readwrite(struct connectdata *conn, if (data->set.http_include_header) k->writetype |= CLIENTWRITE_BODY; + if(data->set.verbose) + Curl_debug(data, CURLINFO_HEADER_IN, + k->p, k->hbuflen); + result = Curl_client_write(data, k->writetype, k->p, k->hbuflen); if(result) @@ -680,6 +687,10 @@ CURLcode Curl_readwrite(struct connectdata *conn, } /* this is the first time we write a body part */ k->bodywrites++; + /* pass data to the debug function before it gets "dechunked" */ + if(data->set.verbose) + Curl_debug(data, CURLINFO_DATA_IN, k->str, nread); + if(conn->bits.chunk) { /* * Bless me father for I have sinned. Here comes a chunked @@ -820,6 +831,11 @@ CURLcode Curl_readwrite(struct connectdata *conn, conn->upload_present = 0; /* no more bytes left */ } + if(data->set.verbose) + Curl_debug(data, CURLINFO_DATA_OUT, conn->upload_fromhere, + bytes_written); + + k->writebytecount += bytes_written; Curl_pgrsSetUploadCounter(data, (double)k->writebytecount);