Isn't this basically a web server for Linux written in C, except with absolutely no standard library optimizations?<p>Yes, it's assembly, but it's basically a thin script over a set of string library functions which are themselves just naive versions of what's already in libc. Most of this is just strcpy/strcat/strchr/strstr; the only reason it's not one giant stack overflow is that it doesn't actually implement most of HTTP (for instance: nothing reads Content-length, and everything works off a static buffer that is sized to be as large as the maximum request it will read). What's the point of writing assembly if you're going to repeatedly scan to the end of strings as you try to build them?<p>I'm not taking away anything from the project as an exercise. It's neat! But like: it's not something you'd ever want to use, or a productive path to go down to make a good webserver.
Nobody mentioned rwasa so I do it (an HTTPs webserver written in asm):<p><a href="https://2ton.com.au/rwasa/" rel="nofollow">https://2ton.com.au/rwasa/</a><p>I proposed to debian (on an IRC channel for that) to make a package for rwasa but I've been told that "nobody does asm in 2017". I wonder if it's still true in 2018.
Sounds like an excelent front end, for best performance. For the back end stability is paramount, that's why I would always recommend to pair this with a shell script server: <a href="https://github.com/avleen/bashttpd" rel="nofollow">https://github.com/avleen/bashttpd</a><p>Bash is undeniably the language with the highest possible stability, you can literally feel the stability and security when a file is served and the hard drives go crazy.
<p><pre><code> %macro stackpush 0
push rdi
push rsi
push rdx
push r10
push r8
push r9
push rbx
push rcx
%endmacro
%macro stackpop 0
pop rcx
pop rbx
pop r9
pop r8
pop r10
pop rdx
pop rsi
pop rdi
%endmacro
</code></pre>
I guess that's one way of saving registers. Not particularly efficient, I guess, but it works…
A couple of past threads:<p><a href="https://news.ycombinator.com/item?id=9571827" rel="nofollow">https://news.ycombinator.com/item?id=9571827</a><p><a href="https://news.ycombinator.com/item?id=7170010" rel="nofollow">https://news.ycombinator.com/item?id=7170010</a>
This is really cool. I admire your bravery.<p>I noticed that certain options are hardcoded (such as the port number). As someone with very little experience in assembly, how difficult would it be to make this dynamic via environment variables?
Looking at the code I’d be surprised if this is anywhere near as fast as a simple equivalent written in C++ (which wouldn’t be as pessimistic with the register saving, in an opt build) or even compared to bozohttpd.
Neat, but unless I am missing something, a nightmare in terms of security. Assembly has a worse type system than even C: essentially no type system at all!<p>(Or rather the weakest, simplest, most dynamic type system you can imagine.)
Nice? I mean, how would you be certain it was NOT a "Web VIRUS for Linux written in amd64 assembly (2017)" unless you could read grok asm?<p>NOTE: I'm not saying it IS or ISN'T, and although I CAN grok asm, I'm not going to take the time to do it right now...<p>Just struck me as possible, given the idea of a high-level language is to mainly provide abstraction over implementation details ( point being, you can't really get any MORE implementation detail specific than asm... )<p>(edit: words...)