News for hackers. Stuff that matters.
Re:30 Years of <Br> Tags by lelanthran on Wednesday December 17, 2025 @01:00AM (#46298741)
> That's folk wisdom, but is it actually true? "Hundreds of lines just to grab a query parameter from a URL."

No, because...

> In practice you would probably parse all parameters at once and maybe use a library.

In the 90s I wrote CGI applications in C; a single function, on startup, parsed the request params into an array (today I'd use a hashmap, but I was very young then and didn't know any better) of `struct {char name; char value}`. It was paired with a `get(const char name)` function that returned `const char ` value for the specified name.

TBH, a lot of the "common folk wisdom" about C has more "common" in it than "wisdom". I wonder what a C library would look like today, for handling HTTP requests.

Maybe hashmap for request params, union for the `body` depending on content-type parsing, tree library for JSON parsing/generation, arena allocator for each request, a thread-pool, etc.

Re:30 Years of <Br> Tags by Akronymus on Wednesday December 17, 2025 @06:42AM (#46300885)
Just FYI the 's got swallowed by the HN formatting and made the stuff inbetween italic.

  struct { char *name; char *value}
can bypass the formatting by prepending 2 spaces
Re:30 Years of <Br> Tags by 1718627440 on Wednesday December 17, 2025 @03:31PM (#46305101)
> Just FYI the 's got swallowed

Ironically enough your *'s as well.

Re:30 Years of <Br> Tags by 1718627440 on Thursday December 18, 2025 @05:03AM (#46310820)
> I wonder what a C library would look like today, for handling HTTP requests.

Isn't that CURL?

Re:30 Years of <Br> Tags by lelanthran on Friday December 19, 2025 @01:38PM (#46329265)
>> I wonder what a C library would look like today, for handling HTTP requests.

> Isn't that CURL?

Curl sends requests, it doesn't handle incoming requests.