https://github.com/foxweb/pico
This is a very simple HTTP server for Unix, using fork(). It's very easy to use.
https://github.com/foxweb/pico
c demo educational-project html http http-server linux unix
Last synced: 7 days ago
JSON representation
This is a very simple HTTP server for Unix, using fork(). It's very easy to use.
- Host: GitHub
- URL: https://github.com/foxweb/pico
- Owner: foxweb
- License: mit
- Created: 2019-03-26T22:25:18.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T16:19:34.000Z (almost 5 years ago)
- Last Synced: 2023-04-13T13:08:39.039Z (almost 3 years ago)
- Topics: c, demo, educational-project, html, http, http-server, linux, unix
- Language: C
- Homepage:
- Size: 559 KB
- Stars: 84
- Watchers: 5
- Forks: 23
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pico HTTP Server in C
This is a very simple HTTP server for Unix, using `fork()`. It's very easy to use.
## How to use
1. Include header `httpd.h`.
2. Write your route method, handling requests.
3. Call `serve_forever("8000")` to start serving on http://127.0.0.1:8000/.
See `main.c`, an interesting example.
To log stuff, use `fprintf(stderr, "message");`
View `httpd.h` for more information.
## Quick start
1. Run `make`.
2. Run `./server` or `./server [port]` (port = 8000 by default).
3. Open http://localhost:8000/ or http://localhost:8000/test in browser to see request headers.
## Testing and benchmarking
I suggest using [Siege](https://github.com/JoeDog/siege) utility for testing and benchmarking the Pico HTTP server.
```sh
> siege -i -f urls.txt
```
## Links
Reworked and refactored from .
Based on .