3 ms·
Also -OJ : with -O you get the name derived from the URL (the initial one, I think, even if redirects are being followed), with -OJ you get the one from the Con
by mananaysiempre 3y ago
Also -OJ : with -O you get the name derived from the URL (the initial one, I think, even if redirects are being followed), with -OJ you get the one from the Content-Disposition header or the final URL, the way browsers do it. Of course, plain -O is safer. (For parity with Wget, you might also want to add -R to set the downloaded file’s mtime according to the Last-Modified header.)
- darnir 3y agoWget will give you an equivalent with the --content-dispisition flag. I would like for it to be the default, but it would likely break backwards compatibility with some scripts that except a different output filename.
- madfucker69 3y ago-OJ is nice but doesn't work with -C- for some reason
- mananaysiempre 3y agoTrue. AFAIU the reason is that Curl wants to make a single request (modulo redirects), whereas making -OJC- work would require two: issue a HEAD to receive the Content-Disposition header and learn the file name, then look at that file and see how long it is, then issue a GET with a Range header to request the suffix you still need to download. With other methods I don’t think you could make this work at all. I don’t know if Stenberg is opposed to a GET-specific solution, perhaps that could be a fun project. (Although I’ve encountered noncompilant servers that couldn’t handle HEADs.)