Live data from Hacker News

Show HN: Building a web server in assembly to give my life (a lack of) meaning

github.com

241–246 of 246 posts

Re: Show HN: Building a web server in assembly to give my life (a lack of) meaning

#241

What I love most about your project is the super clean Makefile ( https://github.com/imtomt/ymawky/blob/main/Makefile ). It is a great template to jump start an ARM64 assembly project. I made a self documented (all the related links are in the file) single makefile ( https://gist.github.com/ontouchstart/d3ad8e4d0adf63532303a90... ) so that anyone can build ymawky from scratch and dig deeper by tinkering.

The reason I wrote that compact makefile is that I am at the beginning of a long journey to study the coding style of ngnk (https://news.ycombinator.com/user?id=ngnk).

I can see the potential of doing some implementation of APL/J/K at levels even lower than C, like how those guys did APL\360 using assembly language. It is going to be super fun in the era of everyone using LLM to pump out verbose Python/TS/Rust code with context windows bigger than the whole operating system.

Re: Show HN: Building a web server in assembly to give my life (a lack of) meaning

#242
post #223

Earlier quoted context omitted.

Aw, that’s too bad. Sounds like it was a really fun project. Thanks for the tips on CGI! Definitely going to look into it more. The server-side execution of CGI scripts definitely interests me more than the CGI scripts themselves, so I’ll probably just look for some existing (simple) CGI scripts and work on building the env vars and executing them.

Implementing a web server that can do CGI is actually probably easier than writing a CGI app. All you have to do for your server is set some environment variables and then spawn the executable.

It was a small "app". But I do remember writing string parsers in Assembly.

My overall lesson was to stick with Perl / CGI-bin.

That being said, I wrote in "Human Readable Assembly" back then. Ex: function calls were:

     mov eax, string
     call myFunction
     .db '\n' ; this parameter for myFunction
I would put compile time constants after the functions. Then I would before returning, pop the return address off the stack and add reg, 1, and push it back on.

It's horribly inefficient to do this today. But it allows you to write more flexible assembly functions that were more readable. Especially with macro-assemblers with some kind of preprocessor.

Re: Show HN: Building a web server in assembly to give my life (a lack of) meaning

#244
post #243

What was the hardest part, Range header handling or the slowloris mitigations? Both seem like they'd be a nightmare without higher-level state machines.

slowloris mititgations actually weren't too bad, just a couple syscalls to setitimer(), sigaction(), and setsockopt(). Range header parsing was awful, so was content length. I'd say all in all, probably Range headers. Just string parsing in general is pretty awful in assembly.

Re: Show HN: Building a web server in assembly to give my life (a lack of) meaning

#245
post #244
post #243

What was the hardest part, Range header handling or the slowloris mitigations? Both seem like they'd be a nightmare without higher-level state machines.

slowloris mititgations actually weren't too bad, just a couple syscalls to setitimer(), sigaction(), and setsockopt(). Range header parsing was awful, so was content length. I'd say all in all, probably Range headers. Just string parsing in general is pretty awful in assembly.

Thanks for the insight. Yeah, hand - rolling string parsing in assembly sounds like a special kind of punishment. Great work getting through it.

Re: Show HN: Building a web server in assembly to give my life (a lack of) meaning

#246

Earlier quoted context omitted.

I think that the analogy of recorded music best captures your feeling. Not the exact technological and economic transformation that is happening, but the feeling. Some 120 years ago recordings music was a living phenomena produced in the moment. Musicians worked at restaurants and coffee shops everywhere, being useful without being super stars. Music didn’t disappear with recordings, but the works is certainly differ…

The analogy is AI music produced without effort in seconds, not recorded music.

What percentage of listened music is AI for you? What about your friends? Your mother’s friends?

AI music is yet to be anything but a curiosity. Recorded music changed so much about everyday life that you can’t imagine the world before it.

Post reply on HN