Build a simple app using node.c
node? Typo?
41–50 of 53 posts
Build a simple app using node.c
node? Typo?
This site feels ridiculously fast. I've noticed that with other compiled frameworks too, e.g. CppCMS: http://cppcms.com/wikipp/en/page/main I wonder if it is just the lightweight HTML the websites use, or if there is really so much speed to gain from using a compiled language.
Looking at the source code : https://github.com/riolet/nope.c/blob/c883b11df78bb8115d5e51... It tries to copy a buffer of 1024 byte (max) into a buffer of 512 bytes (by executing a request with an URL longer than 512 bytes). It also runs 15 children process and use blocking socket, meaning that it's easily "DoS'able". The overall code seems very "unsecure" and poorly designed.
First link on the documentation page is: Build a simple app using node.c node? Typo?
Looking at the source code : https://github.com/riolet/nope.c/blob/c883b11df78bb8115d5e51... It tries to copy a buffer of 1024 byte (max) into a buffer of 512 bytes (by executing a request with an URL longer than 512 bytes). It also runs 15 children process and use blocking socket, meaning that it's easily "DoS'able". The overall code seems very "unsecure" and poorly designed.
That is what happens when language designers decide to throw away design decisions from Algol.
Some of these mistakes transcend the language. Unfamiliarity is one thing but I don't believe you can take someone who writes C code like this and they'll instantly do a stellar job in some other language.
Earlier quoted context omitted.
It depends. It's not like there's no safe way of using strcpy and sprintf.
The safe way to use strcpy is to use strncpy
Earlier quoted context omitted.
That is what happens when language designers decide to throw away design decisions from Algol.
Right, because Algol had non-blocking sockets. Some of these mistakes transcend the language. Unfamiliarity is one thing but I don't believe you can take someone who writes C code like this and they'll instantly do a stellar job in some other language.
Sockets are library/OS responsibility.
Earlier quoted context omitted.
Right, because Algol had non-blocking sockets. Some of these mistakes transcend the language. Unfamiliarity is one thing but I don't believe you can take someone who writes C code like this and they'll instantly do a stellar job in some other language.
I was speaking about unsafe by design. Sockets are library/OS responsibility.
But you can't take the textbook example of what not to do and say that this is representative of everyone who works in the language. Just as I can't take an example of extremely bad code in some high-level language, which naively goes against what is considered sane practice, and say it's the language's fault.
Put alternatively, in many contexts an out of bounds exception is almost as bad as the trouble you can get into with pointers. [I say "almost", conceding the point that with the C you can do crap like clobber a return address on the stack.] Someone who simply doesn't give a shit about array bounds (like this author, it sounds like) is not likely to be totally saved (as if by magic) by a higher-level language.