cURL / Mailing Lists / curl-library / Single Mail

curl-library

callback: data sent to peer

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 5 Mar 2002 20:29:48 +0100 (MET)

Hey

After quite a lot of debugging lately, I've come to think of what I believe
could make better debug outputs with one additional callback in the library.
Yes, I could make the callback conditional on some weird debug #ifdef and
only use it for debug builds, but I also came to think that this might be
interesting to others as well and it can certainly help people understand
things more.

The callback would be named something like "data_sent_to_peer" and I'm
planning to make it get called *after* each single function that sends data
to the remote server. The prototype would look similar to this:

 int
 data_sent_to_peer(CURL *handle, char *dataptr, size_t size, void *clientp);

The 'dataptr' would point to data and the 'size' would indicate how many
bytes of data that was just successfully sent. The 'clientp' pointer is of
course a custom set pointer that libcurl ignores, in the style of the other
callbacks.

This callback would then enable me to add a new option to curl, named
something like --save-sent [filename] and it would then save everything to a
file exactly as was sent to the remote server.

Comments?

Good idea?

Bad idea?

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-03-05