curl-library
Re: callback: data sent to peer
Date: Tue, 05 Mar 2002 15:12:50 -0500
Daniel Stenberg wrote:
>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.
>
It definitely is useful especially in protocol traces to see what was
sent from the client side.But i think size
should point to the no of bytes in dataptr(some of the protocol data
may not be null terminate)or may be we
can add this as an additional param.If size contains the data
successfully sent, it can be less than dataptr size
as its possible that not all of our data has been written to the network
>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?
>
Regards
Bharath
Received on 2002-03-05