Live data from Hacker News

The curl-wget Venn diagram

daniel.haxx.se

101–110 of 159 posts

Re: The curl-wget Venn diagram

#101

Earlier quoted context omitted.

I just look at my curl / wget note for some sane examples. i cant believe one needed chatgpt to be productive

If chatgpt makes someone more productive, then why not. It's just a tool as any other tool.

When it backfires you're screwed, I have experienced it one using curl -L

Re: The curl-wget Venn diagram

#103

Earlier quoted context omitted.

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.)

-OJ is nice but doesn't work with -C- for some reason

True. 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.)

Re: The curl-wget Venn diagram

#104
post #85

Earlier quoted context omitted.

> You recall incorrectly. curl's -C flag does not work as-is. You must specify the offset from where it should continue. Why doesn't it take the resumed file's existing length as the guess by default? What else could the user want outside of some very exotic cases? But... it does, though. From the man page ( https://curl.se/docs/manpage.html#-C ) > Use "-C -" to tell curl to automatically find out where/how to resume…

No, `-C -` is not a flag. It is specifying the `-C` argument with obscure special value of `-`, which causes curl to determine the offset to continue from the output file length. This might be obvious to you if you are well-versed in curl command line, but it's by no means expected or obvious like a simple flag. > But curl is perfectly capable of resuming downloads automatically, you're just (very arrogantly) wrong o…

> I've never claimed it doesn't.

Yes you did:

> You must specify the offset from where it should continue

No, you mustn't, you can specify - and it does exactly what you want. The docs are very clear and even provide examples. At some point you should stop blaming curl for your inability to read a man page and admit that you were simply mistaken.

Re: The curl-wget Venn diagram

#105

For the intersection area, I see no reason to use curl or wget over requests / urllib. Assuming one is inside a script.

Within the python ecosystem, I find httpx to be more similar to curl, and requests to be more like wget. For example, when following redirects or handling connection issues.

Re: The curl-wget Venn diagram

#106

On the cURL side; ridiculous manual I regularly forget the order for the values for --resolve , try searching for that word and figuring it out quickly I've been relegated to grepping a flippin' manual

A trick I've found useful when searching large man pages for a flag --foo is to search for `␣␣--foo` (note the two leading spaces). In my experience this always hits the line where the flag is defined instead of irrelevant mentions of that flag, and it's faster than paging through the manual by hand.

Re: The curl-wget Venn diagram

#107
Ok, wow, I didn't know that curl supported so many protocols - but the fact remains that that small intersection area is probably what > 90% of curl/Wget users are using the tools for. So, from a developer's perspective, the overlap is not that big, but from a user's perspective it might appear much bigger...

Re: The curl-wget Venn diagram

#108

I would also add at least "sane default options", "continues downloads" and "retries on error" to the Wget column. I recently had to write a script that downloads a very large file over a somewhat unreliable connection. The common wisdom among the engineers is that you need to use Wget for this job. I tried using curl but out of the box it could not resume or retry the download. I would have to study the manual and s…

Indeed - and curl requires `-L` to follow redirects whereas wget just does that by default too. So for ad-hoc CLI use, I turn to wget rather than remember all the curl options required.

Re: The curl-wget Venn diagram

#109
post #75
post #40

Earlier quoted context omitted.

well, depends on the usecase. sometimes you want the whole url, like when i want to mirror a site and it has stuff like foo.html?page=1 foo.html?page=2 ... wget does have options to use the name proposed by the server, and so another option to remove the query arguments would be useful, and in line with those.

A new option to strip query parameters from the output filename would be interesting. But its not so simple. When combined with recursion, one will often see a lot of pages with the same name but different query parameters. How should they be stored on disk? There's a couple of different issues I can think of. However, if the potential issues can be resolved with sane defaults, I think this would be a great new switc…

yes, exactly. i think that the option would have to be ignored when doing recursion. or alternatively use the .1 .2 ... method like with all cases where a file of that name already exists.

Re: The curl-wget Venn diagram

#110
post #108

I would also add at least "sane default options", "continues downloads" and "retries on error" to the Wget column. I recently had to write a script that downloads a very large file over a somewhat unreliable connection. The common wisdom among the engineers is that you need to use Wget for this job. I tried using curl but out of the box it could not resume or retry the download. I would have to study the manual and s…

Indeed - and curl requires `-L` to follow redirects whereas wget just does that by default too. So for ad-hoc CLI use, I turn to wget rather than remember all the curl options required.

I think of it like this: curl makes HTTP requests, wget downloads files.

(Though both can be made to do the other thing in some capacity)

Post reply on HN