Top
Best
New

Posted by imtomt 10 hours ago

Show HN: Building a web server in assembly to give my life (a lack of) meaning(github.com)
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/

312 points | 148 commentspage 3
AppAttestationz 6 hours ago|
I suspect that the test suite isn't great. Bun has so many different behaviors compared to other JS engines, sometimes just plain wrong or contradicting the spec. Test suite didnt catch those..
scuff3d 1 hour ago||
This is awesome! I'll have to try reading through the code when I have more time.

It would be awesome to read a blog post about the project. Your approach, lessons learned, unexpected stuff, etc.

washingupliquid 7 hours ago||
Didn't Steve Gibson do this like 25 years ago? AFAIK his "Shields Up" site is written in Win32 assembly.
eptcyka 7 hours ago|
Then it is unlike this, as this is written in arm64, not x86, and not for Win32.
rogeliodh 9 hours ago||
Awesome. Any resource recommendations to learn ARM assembly?
imtomt 8 hours ago||
Honestly, just reading existing assembly to get a feel for how it works, and then violently googling everything that goes wrong. The ARM Architecture Reference Manual (aka "The ARM ARM") ended up being really helpful for looking up what specific instructions do and how they're called. Another really helpful tool is writing something in C/C++, and compiling with "gcc -O1 -S file.c" to see the assembly gcc generated. It helps to mess around a lot with smaller programs in gdb or lldb.
zzz6519003 9 hours ago||
[dead]
boring-human 9 hours ago||
Even after we've all retired (pretty soon for those who can afford it) or transitioned out of software engineering (for those who can't), we'll still get to amuse each other with home-brew projects like this. Warm fuzzy feeling - I'll take it!
imtomt 8 hours ago|
Thank you! This is one of the nicest things I've heard in a while.
bananaboy 8 hours ago||
This is amazing, great work! I love it!
arrty88 7 hours ago||
Love this so much.
niftynanometer 5 hours ago||
Insane
polotics 1 hour ago||
do you know about rwasa?

https://2ton.com.au/rwasa/

...

shevy-java 6 hours ago|
If it is written in assembly, why is it for MacOS only?
DavidPiper 6 hours ago|
Assembly for the correct architecture is only one part of getting an executable running on a machine.

- Dynamic libraries (e.g. for calling into the kernel, but also user space dynamic libraries) are OS-specific (.so for Linux, .dylib for macOS, .dll for Windows)

- Executable format is OS-specific (ELF for Linux, Mach-O for macOS, PE for Windows)

- Dynamic loading and linkage of both the above are also therefore OS-specific

gsliepen 3 hours ago||
And even if you avoid external libraries, you still need to interact with the kernel to do I/O, and that involves system calls that are also non-portable.
More comments...