News for hackers. Stuff that matters.
Re:Building a Website with C++ by chubot on Saturday January 20, 2018 @12:16PM (#16194148)
Really? Escaping, people! This code isn't practical or useful; it's dangerous and sloppy.

    cout << "<body>\n";
    ...
    cout << getenv("QUERY_STRING");     
    cout << "</body>\n";

FWIW I wrote an article about HTML escaping and shell here: http://www.oilshell.org/blog/2017/09/19.html

Followup: http://www.oilshell.org/blog/2017/09/29.html

Also if you want to use a native language for web sites (which I don't), Go is a better choice, as the standard library has html/template which protects you from naive injections:

https://golang.org/pkg/html/template/

Re:Building a Website with C++ by bcjpjk on Saturday January 20, 2018 @12:24PM (#16194202)
Yeah... this example code is bad. Not to mention that CGI is slow, problematic, and chock full of potential security issues. At the very least, spawning a process per request is a DOS attack waiting to happen, even if the code were immaculate.
Re:Building a Website with C++ by poizan42 on Saturday January 20, 2018 @12:53PM (#16194394)
Classic CGI is not the best performing interface, yes. But there's a big difference in launching a complete interpreter for every request, and running a small purpose-built native program. And remember that people did manage the former 20 years ago, sites like Slashdot were running CGI Perl scripts back then.

I'm not sure about the "chock full of potential security issues". You have to be careful with trusting environment variables as the Bash guys learned, but I don't know what else there is that is specific to CGI.

Re:Building a Website with C++ by jayrwren on Saturday January 20, 2018 @01:19PM (#16194553)
Forking a process per request is expensive, interpreter or not.

Slashdot used apache mod_perl back then. It never forked a process per request.

Re:Building a Website with C++ by poizan42 on Saturday January 20, 2018 @10:34PM (#16196747)
Slashdot started in 1997, the first release of mod_perl was on 12.03.1998. They certainly used cgi at first, just check the url here: https://web.archive.org/web/19980113191337/http://slashdot.o... - it says cgi right there.

Edit: Seems I was wrong about the date, it was actually 28-Jul-1997[1], nevertheless slashdot was only launched two months later, and as the link above witnesses didn't seem to have used it at first.

[1]: https://web.archive.org/web/19971210053529/http://perl.apach...

Re:Building a Website with C++ by goldenkey on Saturday January 20, 2018 @01:29PM (#16194620)
CGI was commonly used by everybody and anybody in those years. I recall Slashdot having some CGI pages, not everything but forms processing.
Re:Building a Website with C++ by candiodari on Sunday January 21, 2018 @03:06AM (#16197275)
Then I have good news for you !

https://en.wikipedia.org/wiki/FastCGI

Also: DOS attacks against capacity sound positively benign compared to what they translate to on cloud : DOS on your credit card.

Re:Building a Website with C++ by mcosta on Sunday January 21, 2018 @12:45PM (#16199032)
What is lambda?
Re:Building a Website with C++ by entropie on Saturday January 20, 2018 @03:31PM (#16195253)
> In this article, I’ll explain how you can use C++ to develop a website and some concrete reasons why you might consider doing so.

I dont find any reasons at all. That article ist just a clickbait nonsens.

Re:Building a Website with C++ by carterehsmith on Saturday January 20, 2018 @05:56PM (#16195893)
"Building a Website with C++" "Is This Even Possible?"

We can just "flag" articles like this one.

Re:Building a Website with C++ by flatline on Saturday January 20, 2018 @12:23PM (#16194196)
CTemplate is a not-unreasonable option for C++ as well.