Kcgi – minimal CGI and FastCGI library for C/C++

(kristaps.bsd.lv)

24 points | by Bluestein 1 day ago

4 comments

  • Bluestein 1 hour ago
    (In this pseudo-resurgence of common sense, somebody ought to at least have a passing memory in mention, of perl, the OG CGI language ...)

    All hail TIMTOWTDI! :)

  • hatefulheart 1 hour ago
    Everyone in this thread is going to call out issues with writing a Web application using C.

    Refer to the newest Talk Python podcast where a core CPython developer was told that Python is memory safe and his response was “is it?”.

    At some point we need to be more sophisticated about this, our hardware is fundamentally unsafe, anything we build on it is fundamentally unsafe and there are degrees to which things are better or worse and that’s it. All that matters is the love, rigour and care you put into your work.

    Proceed as you wish, a backend in C is valid a backend in LISP is valid.

    • rfgplk 1 hour ago
      People don't realize how much performance they're leaving on the table by not using C/C++/Rust. Get uWebSockets and set up a demo server, it's going to be 10-50x faster than a Node.js server. Quite literally the performance delta is that drastic.
      • lukaslalinsky 1 minute ago
        You would be surprised how fast Node/Bun can be if you scale them properly. Even uWebSockets was primarily done for JS integration. If what you are doing in your application is database queries and some template rendering, you might not actually gain that much from these compiled languages.
      • nightfly 2 minutes ago
        Most people don't need to care about that. If you're writing something that's gonna be used by a fixed number of real humans a few times (or a even a few 1000) times a day the overhead isn't gonna matter
      • pjmlp 1 hour ago
        Or Go, OCaml, Haskell, Java, C#, D, Ada,....
  • self_awareness 2 hours ago
    Anyone brave enough to write a webapp in C++?
    • Ono-Sendai 7 minutes ago
    • pjmlp 1 hour ago
      It used to be the way before Java, .NET took off, only to be replaced by slow interpreted languages, because who cares, the database is the bottleneck.

      Note that PHP and Perl also had enough C code, and Apache/IIS plugins, with enough C and C++ extensions.

      Now all those "who cares scripting languages" are getting JIT compilers, or being rewritten into Go and Rust.

    • cowboylowrez 1 hour ago
      I play with c some but I just could not stand the libraries I could find to work with fast cgi, just totally opaque and I would get hung up on things like handling some socket a doohicky would hand over and I'm supposed to work with it and I could never figure it out.

      Once I ditched the library idea and just coded to the spec things went much nicer lol it turned out to be a relatively normal socket coding project. Just hobby code tho.

    • forgotmypw17 2 hours ago
      OkCupid did it back in the day...
    • rfgplk 1 hour ago
      Yep, me. In fact, I wrote a whole netstack in C++, meaning everything from opening sockets to the web server to the tls crypto code to the sse/middleware layer of the framework. Quite literally, there is _ZERO_ externally used third-party code anywhere in the netpath. Performance is amazing, I can serve effectively ~600k full HTTPS requests per second on a single Skylake core.
  • zy445566 2 hours ago
    [dead]