cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Use of -O -J -D

From: Tatsuhiro Tsujikawa <tatsuhiro.t_at_gmail.com>
Date: Fri, 25 May 2012 18:32:17 +0900

On Thu, May 24, 2012 at 4:30 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Thu, 24 May 2012, Tatsuhiro Tsujikawa wrote:
>
>> 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?
>
>
> I would say it is a bug.
>
>
>> 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:
>
>
> Yes I think so, it just mustn't detroy what -i does. "curl -O -J -i [URL]"
> would include the headers in the output file name.
>
> Care to send a patch for this?
>

Yes. The patch attached.

I tested with -O -J -D, -O -J -i and -O -J -D -i. All worked.

Some tests failed because after the change, curl code always sets
CURLOPT_HEADERFUNCTION and CURLOPT_HEADERDATA.
I updated the test data to include these options.
I'm not sure this is the right way to fix the tests.

Best regards,

Tatsuhiro Tsujikawa

> --
>
>  / daniel.haxx.se
> -------------------------------------------------------------------
> 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

-------------------------------------------------------------------
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-25