cURL / Mailing Lists / curl-library / Single Mail


Re: [PATCH/RFC] More flexible output filename (based on HTTP reply)

From: Daniel Stenberg <>
Date: Fri, 27 Mar 2015 00:10:41 +0100 (CET)

On Mon, 16 Mar 2015, Leon Winter wrote:

> while "-J" parameter is described as "based on the header" it is also then
> said the information is explicitly the "Content-Disposition" header field.
> So we could "enhance" the -J parameter functionality of course. Or maybe one
> even want to add a new option to enable this "follow redirection file name"
> behavior. This yeah, I am with you. If at all this belongs to the "magic" -J
> parameter.

Right, the docs says so today but I'm mostly saying that we'll probably get
the least number of surprised users if we require -J for this new behavior to
happen rather than just -O. Well, perhaps even less with a totally new option
but I really don't think we should go there. We have option fatique already,
no reason to dig that grave even deeper.

> If the use wants a predictable filename he would use "-o". "-O" is just for
> lazy people who for some reason do not want to grep the "filename" part out
> of the URL first.

I'm not disagreeing with you, but -O gives a fixed file name based on the
original URL and it has _always_ worked like that there's no denying of that.
I'm not comfortable in breaking that unwritten contract.

> The use would expect the download to continue. Short URLs are very common
> these days. Also the "Content-Disposition" header is heavily used. So why
> should curl fail for this use case?

Nah, you're right of course. It is only code, of course we can make it work.
You've convinced me.

>> Hm. I'll try to give that a closer look soon.
> I am not sure if I was clear enough. The error only occurs with the patch
> applied. For some reason curl tries to call the write function before the
> header with the filename would be received. Then it bails out with "empty
> remote name". I have yet to debug this.

Ok, but still: if you have an refreshed version of the patch you're happy with
for now, I could try to check closer what's going on and then we can decide on
how to act from there.

List admin:
Received on 2015-03-27