Skip to content

A tiny syscall-only HTTP responder written in pure x86_64 NASM for Linux.

License

Notifications You must be signed in to change notification settings

renanleonellocastro/assembly_http_simple_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Assembly x86 HTTP Simple Server

License: MIT Architecture Syscalls Only Assembly Zero Dependencies

A tiny, fully handmade HTTP server written in pure NASM x86_64, using only raw Linux syscalls: no libc, no C runtime, no external dependencies.

It accepts TCPs connections and responds with a minimal HTTP/1.1 message. The project is intentionally small, simple, readable, and educational, showing how things work under the hood.

🖥️ Demo

$ ./assembly-http-server
# (server running)

$ curl http://0.0.0.0:8080
Hello from asm HTTP server!

🤔 Why This Exists

This project was built to:

  • Showcase real-world Linux syscall programming in assembly
  • Demonstrate socket(), bind(), listen(), accept(), read(), write(), close(), and fork()
  • Show how a TCP server works with zero abstractions
  • Offer an educational codebase where each syscall is implemented in a dedicated file
  • Help others understand that low-level programming is not impossible, it's actually fascinating

If you're curious how the kernel expects things to be laid out in memory… this repo is for you.

📦 Installation

git clone https://github.com/renanleonellocastro/assembly_http_simple_server.git
cd assembly_http_simple_server

🛠️ Build

Make sure you have:

  • nasm
  • ld
  • Linux x86_64 system

Then simply:

make

Run:

./assembly-http-server

Your server will now be listening on:

http://0.0.0.0:8080

🤔 Usage

Once running, open your browser or use curl:

curl http://0.0.0.0:8080/

🧩 Project Structure

assembly_http_simple_server/
│
├── src/
│   ├── main.asm           # Entry point, server loop, accept(), fork(), reading request
│   ├── handler_send.asm   # Sends HTTP response
│   ├── net_sockaddr.asm   # sockaddr_in structure
│   ├── sock_socket.asm    # All syscall wrappers (one per file)
│   ├── sock_setsockopt.asm
│   ├── io_write.asm
│   ├── sock_bind.asm
│   ├── sock_listen.asm
│   ├── sock_accept.asm
│   ├── sys_fork.asm
│   ├── sys_wait4.asm
│   ├── io_close.asm
│   └── sys_exit.asm
│
├── Makefile
├── LICENSE
└── README.md

Every function lives in its own file, keeping the implementation extremely clean and easy to study.

✨ Features

  • 🔧 Pure Linux syscalls (no libc)
  • 🧱 One syscall per file for educational clarity
  • ✍️ Well-commented Assembly, written for humans
  • 🧵 Fork-per-connection model
  • 🌐 Minimal, valid HTTP/1.1 Response
  • 🔒 No dependencies
  • 📚 Perfect for learning/demonstrating low-level knowledge

🤝 Contributing

Contributions, issues and pull requests are welcome! If you'd like to add features, improve documentation, or extend the educational content, feel free to open an issue.

⭐ License

This project is released under the MIT License. See LICENSE for details.


If you found this project useful or interesting, please consider giving it a ⭐ on GitHub!


About

A tiny syscall-only HTTP responder written in pure x86_64 NASM for Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published