Live data from Hacker News

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

github.com

1–10 of 246 posts

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

#1
This is ymawky, a static file web server for MacOS written entirely in ARM64 assembly. It supports GET, PUT, DELETE, HEAD, and OPTIONS requests, and supports Range: bytes=X-Y headers (which allows scrubbing for video streaming). It decodes percent-encoded URLs, strictly enforces docroot, serves custom error pages for any HTTP error response, supports directory listing, and has (some) mitigations against slowloris-like attacks.

I’ve also written a more detailed writeup here: https://imtomt.github.io/ymawky/

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

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

#3
I'm wanting to read this repository as a learning tool, so it'd also be nice to include docs—even AI-generated docs, but obvious I'd prefer docs with your own design notes and decisions—about the architecture of the code.

Really cool project though!

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

#6

I'm wanting to read this repository as a learning tool, so it'd also be nice to include docs—even AI-generated docs, but obvious I'd prefer docs with your own design notes and decisions—about the architecture of the code. Really cool project though!

Thanks, I appreciate it a lot! I tried to comment my code pretty heavily (~3000 lines of code, ~1000 lines of comments all together), since this was a learning project for myself in the first place. Hopefully those will be of some use. But separate in-depth documentation is definitely a good idea, I'll work on adding that. In the meantime I'm always down to answer any questions about it!

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

#8
post #6

I'm wanting to read this repository as a learning tool, so it'd also be nice to include docs—even AI-generated docs, but obvious I'd prefer docs with your own design notes and decisions—about the architecture of the code. Really cool project though!

Thanks, I appreciate it a lot! I tried to comment my code pretty heavily (~3000 lines of code, ~1000 lines of comments all together), since this was a learning project for myself in the first place. Hopefully those will be of some use. But separate in-depth documentation is definitely a good idea, I'll work on adding that. In the meantime I'm always down to answer any questions about it!

My first question would be where should I start reading? It seems like you modularized it into multiple assembly files (how does that even work?)

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

#9
post #2

This post seems to now link to the writeup rather than the repository, sorry! The repo can be found at the top of that page, or directly here: https://github.com/imtomt/ymawky

Whoops that was my fault. Fixed now. (I emailed you, btw, that we'd changed your title, but I forgot to switch the URL back to the repo. Both links are cool.)

I'm sure I'm not the only one who has fantasized about doing something like this as a self-soothing enterprise. Kudos to you for actually doing it!

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

#10
I feel the guy’s suspicion towards any high level language. I exclusively programmed in assembly on C64, Amiga and the recognized that this ain’t sustainable on PC because there are more and more edge cases or different machine configurations.

I had a very hard time simply using and even utilizing C++ or Java.

C and Turbo Pascal especially was easier because the compiled code was very much resembling to hand written code.

As the author described, you can do in 4.000 lines what others can do with way less pain in 100.

So you build macros, come up with your own library and in the end you kind of build a meta language build on top of assembly because some lines are so hard to grasp that you delegate working code into a library for reuse.

It is funny how much we take conventions for numbers for granted. If you happen to know assembly and its intricacies you immediately will learn to work with a sign bits which mark negative numbers. But how do you know? Maybe you use the whole addressable space only for positive numbers.

Small things that make a huge different.

Nice article, I enjoyed your adventures and would do the same.

Post reply on HN