Live data from Hacker News

“I Could Rewrite Curl”

daniel.haxx.se

71–80 of 193 posts

Re: “I Could Rewrite Curl”

#71
post #15

What's frustrating is people who think that they can radically simplify something without knowing anything about it. The same people think they can implement a text editor in 1000 lines of code because that's how the first text editors were made. Why can't we go back to those simple days? We can't because modern software handles cases that those didn't. For example, rendering and editing text seems straightforward un…

>If we tried to reimplement this stuff from scratch, we would likely start with a simple implementation, then tack on bits when we tried to handle issues like right-to-left layouts, Unicode, emoji, anti-aliasing, text overlapping and so on.

This is why I always try to look back as far as I can in a source's history to see how it started. It at least gives me a sense of the amount of work it takes to get from simple to mature.

Re: “I Could Rewrite Curl”

#72
post #49

Earlier quoted context omitted.

Plenty of applications use TCP and UDP, or even custom protocols on top of raw IP. Not everything needs to come through the browser.

Not everything on top of HTTP comes through the browser, either ;)

More and more APIs use HTTP as the transport for various reasons, but one of them is that HTTP has considered large number of edge cases and has been tested "in the fire" - rolling your own custom API with security and encryption is much more fraught with dangers.

Re: “I Could Rewrite Curl”

#73
post #30

Let's be honest here. Curl to 98% of people is http/1 requests with some post params and maybe json body, with some custom headers. Most language standard libs (which might be using libcurl) can facilitate writing that relatively quickly. And probably with a more 'modern' CLI. Curl though, is a very wide breadth project. It currently supports the following protocols: DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP,…

> What Daniel Stenberg achieved is giving the world a fantastic, reliable, cross protocol, cross platform and cross language network library that can be used as the foundation for many projects.

One of which, curl(1), is a constant ass-and-life saver for me personally and professionally. Of course the library itself ends up being used by me as well (in C, ++ and tcl). curl to me is in the league of sqlite aka "absolutely gorgeous and more often than not all you need"

Re: “I Could Rewrite Curl”

#74
post #46

Earlier quoted context omitted.

And in fact even the "simplest" editors seemed to take quite some time even for our heroes. Ken Thompson has stated [1] that he devoted a week out of a month for what I understand was the first version of ed(1): [...] [my wife] was gone a month to California and I allocated a week each to the shell, to the operating system, the shell, the editor, and the assembler, to reproduce itself [...] [1] https://www.princeton.…

An editor seems insanely simple until you realize that computers really don't like "inserting" data into existing data in memory, and then you're staring down the barrel of continuous memcpys.

Weird. First idea that came to my mind was to use a linked list of lines.

Re: “I Could Rewrite Curl”

#75

Earlier quoted context omitted.

This reminds me of bocker. ( https://github.com/p8952/bocker ) A minimal docker in 100 lines of bash.

A great example, in that there are six year old (important looking!) PRs sitting there without any feedback or action. Ongoing maintenance of this nature is something often ignored by the "I could rewrite that, easy" folks.

It's a joke / PoC project. Nobody should expect it to be maintained in any way. None of those PRs are important in that way.

Re: “I Could Rewrite Curl”

#77
post #30

Let's be honest here. Curl to 98% of people is http/1 requests with some post params and maybe json body, with some custom headers. Most language standard libs (which might be using libcurl) can facilitate writing that relatively quickly. And probably with a more 'modern' CLI. Curl though, is a very wide breadth project. It currently supports the following protocols: DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP,…

Yeah, very easy to write an HTTP client on top of Berkley sockets. Until chunked responses come into play, and HTTPS, and HTTP/2, and HTTP/3... (this is actually something I'm very worried about, it used to be easy to cobble together a very basic HTTP client, not anymore with the new HTTP protocol versions, and all the bells and whistles).

Agreed. They're harder to debug, MITM, trace, etc.

As a silver lining: I have been less worried recently seeing that most of the adoption of http/2-3 (at least their odd features) have been at the edge. Most developers are still writing http/1 endpoints and leaving the edge to optionally up-convert them for transport efficiency.

Re: “I Could Rewrite Curl”

#78

Earlier quoted context omitted.

I am always highly annoyed when someone has documentation for their web API and all that they provide is some postman collection of crap (or a crappy code example in an arbitrary language) and some vague abstract description of their API. Then I'll have to spend X amount of time on reverse engineering it to curl so I can see what's actually going on. Often I'll discover that they're doing really weird stuff (double b…

Doesn't Postman have a feature to allow exporting the request as curl and others though?

[deleted]

Re: “I Could Rewrite Curl”

#79
post #5

I can write cURL in 1 line of bash: alias mycurl='curl' /s

I think there's more truth to this comment than your presentation suggests. I bet at least a subset of people who think they could reimplement curl easily, think of curl as a CLI tool to make HTTP requests. It's just a little bit of python/requests or node/fetch code to cover some basics for that. I think these people simply aren't aware that their programming language's built-in libraries often call in to libcurl fo…

exactly, my point was, some people think they can build it in a day, because they see their favorite library already supports sending HTTP, they might not be aware that some of those libraries are wrappers around cURL library

Re: “I Could Rewrite Curl”

#80
If you're a fan of curl and have benefited from it but can't contribute via code, docs, etc, I'd recommend their OpenCollective page: https://opencollective.com/curl

Many employers let you expense $50-100/month without much effort so get a handful of friends and it has a bigger impact than one corporate contributor.

Post reply on HN