Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mementomori11723/c-http
A simple http server written in C
https://github.com/mementomori11723/c-http
Last synced: 25 days ago
JSON representation
A simple http server written in C
- Host: GitHub
- URL: https://github.com/mementomori11723/c-http
- Owner: MementoMori11723
- Created: 2024-11-30T04:34:55.000Z (27 days ago)
- Default Branch: main
- Last Pushed: 2024-11-30T05:50:24.000Z (26 days ago)
- Last Synced: 2024-11-30T06:20:06.357Z (26 days ago)
- Language: C
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# C-HTTP
A Lightweight and Minimal HTTP Server Written in C that serves static files and stops when the Enter key is pressed.
## How to Run
1. Clone this repository:
```bash
git clone http://github.com/MementoMori11723/C-http.git C-HTTP
cd C-HTTP
```2. Build the project using `make`:
```bash
make
```3. Run the server:
```bash
./simple_http
```The server will run on `http://localhost:8000`.
4. To stop the server, press the **Enter** key.
## How to Test
1. Open a browser or use `wget` or `curl` to test the server:
```bash
wget http://localhost:8000/index.html
```
or```bash
curl http://localhost:8000/index.html
```2. If the requested file is found, it will be served with a `200 OK` response. If the file is not found, a `404 Not Found` response will be sent.
## What It Does
- The server listens on port 8000 for incoming HTTP requests.
- It serves files based on the requested URL.
- If the file exists, it sends the file with a `200 OK` response.
- If the file does not exist, it sends a `404 Not Found` response.
- The server stops when the **Enter** key is pressed.