Skip to main content


"a filename when none exists"

Starting in #curl 8.10.0, curl works a little harder to come up with a filename to store the download in when -O is used.

https://daniel.haxx.se/blog/2024/08/19/a-filename-when-none-exists/

#curl
This entry was edited (1 month ago)
in reply to daniel:// stenberg://

i always wished that -O used the Content-Disposition header to name that output file.. is there a reason this isn’t a thing?
in reply to Domi_\[\]\w\[\]

@domi yes: because then you don't know ahead of time what the file will be named.
in reply to daniel:// stenberg://

@domi does that mean you create the file before connecting or receiving headers?
in reply to daniel:// stenberg://

I feel a little silly for asking this, but you typically have the content-type header, right? Why do you not use that to create a file extension for the fallback file? Is it because the content-type could be lying?
in reply to gfaster :flandre:

@gfaster because -O needs to set a fixed ahead of time known file name that is not controlled by the server-
in reply to daniel:// stenberg://

Why is clobber the default behavior?
Wouldn't no-clobber be a safer default behavior, with '-overwrite' or '-i-tell-you-three-times' be required to actualize the destruction?
in reply to RealGene ☣️

@RealGene it is the default because that's the way it has worked since the beginning and changing it now would break scripts all over
in reply to daniel:// stenberg://

in the case of http://example.com/one/two/?id=42, what happens when the file 'two' already exists and then you change it to id=43?