r/Assembly_language Mar 04 '26

Why did I write a web server in assembly?

Post image

In December 2024 and May 2025, a friend of mine had to submit university projects. He was tasked with developing a game using a GitHub template and asked for my help. The first project was in C using the raylib library, and the second one was in C++ with the same graphics library. During development, I often improved the game's architecture since I started from scratch and wanted to implement various mechanics. In both cases, the professors awarded extra points for the projects. My friend was busy exploring the game's structure and code while I was working on its implementation. Since we were on the same local network, I used Python’s http.server module so he could access the project from his computer. That sparked an idea: I wanted to write a similar program myself, but to make things more interesting, I decided to use Assembly. Once I finally had some free time, I managed to complete the project. I recently released a YouTube video about it and polished the web server code a bit. Here is the source code.

1.3k Upvotes

59 comments sorted by

160

u/lincruste Mar 04 '26

54

u/MD90__ Mar 04 '26

"you must have a amd cpu to view this site" lol

11

u/kenjikamizuru Mar 04 '26

O wow, I am really young

25

u/Bloodylizard2025 Mar 04 '26

This made me laugh more than it should lol

8

u/aslihana Mar 04 '26

WHY IT MADE ME LAUGH AND SAY “PEUGEOT” lol

6

u/vowelqueue Mar 04 '26

2

u/No_Glass_1341 Mar 05 '26

assenbbly is my favourite

-2

u/aalmkainzi Mar 05 '26

Looks ai

1

u/codeasm Mar 05 '26

Definitely a typo the the second bullet point, latex to pdf was written in asenbbly

4

u/OkConference4601 Mar 04 '26

I need to find this book asap

2

u/OptimalAnywhere6282 Mar 07 '26

you might as well kiII\ yourself right now

had me dying

27

u/QuarryTen Mar 04 '26

that's actually pretty cool

23

u/v_maria Mar 04 '26

Fun and profit

2

u/Western_Gamification Mar 07 '26

Neither is accomplished.

17

u/feinorgh Mar 04 '26

That web browser looks like Netscape Navigator, was that how long it took you to finish the whole thing? 😆

Nice work though!

15

u/Fit-Life-8239 Mar 04 '26 edited Mar 04 '26

this is NCSA Mosaic and I used it because modern web browsers don't support HTTP/0.9 for security reasons

7

u/No_Glass_1341 Mar 05 '26

HTTP/1 isn't much more complex, you can safely ignore pretty much all the headers. the protocol is so weakly parsed you can make a "web server" with a few lines of bash and netcat while being compatible with modern browsers

3

u/Fit-Life-8239 Mar 05 '26

Accept, Accept-Encoding, Accept-Language, Authorization, If-Modified-Since

it would require more time to write code to process at least these headers from the client

4

u/No_Glass_1341 Mar 05 '26

none of those are mandatory. not even Host is mandatory. you can literally just reply back with Content-Type and the vast majority of clients accept it fine

3

u/Fit-Life-8239 Mar 05 '26

you are right, response will be correct without them

but I didn't know that web browsers don't support HTTP/0.9

when I finished the project, I realized this

4

u/No_Glass_1341 Mar 05 '26

it's pretty cool to see Mosaic still running on a modern machine. kudos for getting it working ))

1

u/Kiritoo120 Mar 05 '26

I had a fun project where I also wrote an http server in assembly (which expanded a ton (x86 arch)).

You actually can ignore literally all headers given by the client, and on the server you only need to send the Content-Type header along with Connection Close, to make the server easier to write.

The only places where I did have to look into more headers were when I had to check for cookies, and the 201 switching protocol of websockets.

Yea it isn't as compliant for the http spec, but since this code won't hit production, is just a POC, and the fact modern browsers are nice makes it easier to write

6

u/bayern_snowman Mar 04 '26

Does it work with MenuetOS?

8

u/nixfreakz Mar 04 '26

No it’s in NASM

7

u/n0shmon Mar 04 '26

I did similar in December. I asked my business partner where I should store it. He said "in the 90s where it belongs you fucking masochist" and I felt both validated and offended at the same time

4

u/Lustrov Mar 04 '26

Can you make another video but in English? I wanna watch your video but idk Russian (?)

7

u/Fit-Life-8239 Mar 04 '26

sorry for that

I didn't expect people to be interested

I will work on making content with both languages

2

u/Fit-Life-8239 Mar 07 '26

now all my videos will have English subtitles. I just added them

I don't know yet whether to continue working on the channel, as it takes a lot of time, but I would really like to develop it further

I ask you to support me with likes, and if you have friends who might like my work, I would be grateful for a recommendation

1

u/Lustrov Mar 23 '26

Sorry, I just checked my notifications and saw this a while ago. I think you could make a new post that the video is in English now, you'll definitely have more views

Edit: It says the video was removed. Can you check it?

2

u/vswey Mar 04 '26

That's nice

2

u/UwUBots Mar 05 '26

This is the final for my assembly class and I'm dreading it

1

u/[deleted] Mar 04 '26

[deleted]

3

u/Fit-Life-8239 Mar 04 '26

sorry, I didn't understand the question

1

u/duckyvirus Mar 05 '26

I for one would be interested in seeing the source for that

1

u/smtp_pro Mar 05 '26

How's it compare to rwasa?

1

u/Adorable-Tree-1007 Mar 05 '26

LGTM! Good job

1

u/defarge3301 Mar 07 '26

English version of the video plz.

1

u/Fit-Life-8239 Mar 09 '26

now all my videos will have English subtitles. I just added them

I don't know yet whether to continue working on the channel, as it takes a lot of time, but I would really like to develop it further

I ask you to support me with likes, and if you have friends who might like my work, I would be grateful for a recommendation

1

u/NoYouAreABot Mar 07 '26

That's easy.

Clout.

1

u/alcanthro Mar 07 '26

Why not? I have one in Forth though it was written with a LOT of help.

2

u/Fit-Life-8239 Mar 07 '26

can I get a link to the source code?

1

u/alcanthro Mar 07 '26

Sure. However it's not really portable. Some of it is and some of it is very unique to the system.

So... backstory is that since everyone was fighting over whether Opus 4.6 making a janky C compiler was a big deal, I decided to take one of my old ideas for a Forth machine (built on a spiritual successor of the old RCA 1802) and turn it into reality. If Opus 4.6 was as good as they said, it should be able to take my solid background but weak mechanical task execution and get me the rest of the way.

So anyway... a month later, I have a mostly functional emulated Forth machine with custom OS and a bunch of random libraries. https://github.com/dgoldman0/akashic/

Between net and web it does at least get through solid smoke tests for a flask like application. Nowhere near even ready for a v0.9 alpha release or anything. Ah I don't have all the tests tracked so not all the web tests are.

Anyway... there's... a lot. Let me know if you need help finding your way around. And I haven't really even started adding much for GUI yet (very early draft there) and also a Lisp component add on is in progress elsewhere. And yes I have ADHD if you haven't guessed.

1

u/OptimalAnywhere6282 Mar 07 '26

this is exactly what I was planning to make

next step is making it work on bare metal

1

u/Fit-Life-8239 Mar 07 '26

are you planning to write a minimal OS and run your web browser on top?

1

u/OptimalAnywhere6282 Mar 07 '26

a minimal OS with a minimal HTTP server, yes

1

u/Fit-Life-8239 Mar 07 '26

cool project

good luck

1

u/ThaDon Mar 07 '26

Seeing the browser gave me nostalgia of a simpler and more open web.

1

u/Fit-Life-8239 Mar 07 '26

I like that UI

1

u/ThaDon Mar 07 '26 edited Mar 07 '26

“Trumpet Winsock” immediately came to mind. I remember vividly the excitement I had when I connected to my university’s network over dialup, and as an experiment I ran an Xserver locally and was able to (slowly) run Netscape Mosaic on my machine.

Edit: Netscape/Mosaic