cURL / Mailing Lists / curl-users / Single Mail

curl-users

Use of -O -J -D

From: Tatsuhiro Tsujikawa <tatsuhiro.t_at_gmail.com>
Date: Thu, 24 May 2012 04:02:02 +0900

Hi,

When running curl with -O -J -D header.txt, curl creates header.txt
but it is empty.

$ curl -O -J -D header.txt http://curl.haxx.se/download/curl-7.25.0.tar.gz

Is this by design or bug?

If it is by design, I think it is user-friendly to print a warning.
If it is the bug, then the possible fix is extend tool_headr_cb and
inside the function, check config and do content-disposition check and
header dump. Defining some storage structure is handy here like this:

struct HeaderFuncArg {
    struct OutStruct *outs;
    struct OutStruct *heads;
};

HeaderFuncArg arg;
arg.outs = &outs;
arg.heads = &heads;

and

my_setopt(curl, CURLOPT_HEADERFUNCTION, tool_header_cb);
my_setopt(curl, CURLOPT_HEADERDATA, &arg);

Any thoughts?

Best regards,

Tatsuhiro Tsujikawa
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-23