This project is a simple HTTP server that returns "Hello, World!" in HTML to any client that connects to it (NOTE: it does not validate requests nor parses them).
I wanted to learn more about Arm64 assembly language. I find that writing a simple HTTP server teaches you te basics of a new programming language or platform quickly. It’s a good way to learn about sockets, file I/O, and string manipulation.
Please do not use my code as a reference for writing assembly language. I am not an expert in assembly language and I am sure that there are many things that I could have done better. I wrote this project as a learning exercise and even though it works, I am sure that an experienced assembly language programmer would have written it differently.
Additionally, I wrote this project for macOS. It probably can run on Linux or other Unix-like operating systems, but it probably would require modifications to the makefile and (possibly) the assembly code.
I will likely not be accepting any contributions to this project. I wrote this project as a learning exercise and I don’t see it as something that I would like to maintain or expand upon. I am open to answering questions about the project but don’t plan to accept any pull requests.
You probably already have the development tools that you need to build this project. Nevertheless, you will need both clang
, ld
, and make
to build the project.
You can install these tools using the Xcode command line tools. If you don’t have the Xcode command line tools installed, you can install them by running the following command in your terminal:
xcode-select --install
It’s really easy to build the project. Just run the following make
command in your terminal:
make all
This will build the project and create an executable called ./build/server
.
If you run the server and then open a web browser and navigate to http://localhost:4523
, you will see a web page that says "Hello, World!". Here is it in it’s response form:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 52
<!DOCTYPE html><html><body>Hello World</body></html>
You will also see the following output in the terminal where you ran the server:
Starting server...
Server ready at http://127.0.0.1:4520/
Waiting for connection...
Sending data...
Waiting for connection...