Daniel Stenberg, 05.07.2012 16:12:
>> is there a simple way to make curl_easy_perform() not to output any
>> data? I just want to HTTP-POST something to a web interface and are
>> not interested in the server's reply.
> I read that as you want to stop receiving data and not just not output it?

Oh, no, I do want to receive the server's reply (or at least the HTTP
code), I just don't want curl output the data on the console (stdout or
stderr). The server's reply is only a single line, so there's no harm in
reading that from the network.

If there's currently no simple way to do that, may I propose that make
that possible? E.g. by calling the write function only if it is set to a
custom func or the file handle being not NULL. As far as I see the write
function is only called at one place, so that should be fairly simple.
The attached patch does just that (untested, though).


diff -urN curl-7.26.0-orig/lib/sendf.c curl-7.26.0-jh/lib/sendf.c
--- curl-7.26.0-orig/lib/sendf.c	2012-03-08 20:35:25.000000000 +0100
+++ curl-7.26.0-jh/lib/sendf.c	2012-07-05 18:21:57.284367439 +0200
@@ -452,7 +452,7 @@
     }
     /* If the previous block of data ended with CR and this block of data is
        just a NL, then the length might be zero */
-    if(len) {
+    if(len && (data->set.out != NULL || set.is_fwrite_set)) {
       wrote = data->set.fwrite_func(ptr, 1, len, data->set.out);
     }
     else {
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to