Update README

This commit is contained in:
2025-07-22 12:07:26 +02:00
parent 6412aab833
commit b73ad9f234
+21 -14
View File
@@ -1,11 +1,21 @@
# cHTTP # cHTTP
cHTTP is an HTTP **client and server** library for C with minimal dependencies and **distributed as a single chttp.c** file. cHTTP is an HTTP **client and server** library for C with minimal dependencies and **distributed as a single chttp.c** file.
Here is a list of features:
* HTTP 1.1 client and server
* Fully non-blocking
* Cross-Platform (Windows & Linux)
* HTTPS support (using OpenSSL)
* Virtual Hosts
* Single-threaded
* Zero-copy interface
## Getting Started ## Getting Started
The library is distributed in a single amalgamated `chttp.c` file or as a static library, so you can: The library is distributed in a single amalgamated `chttp.c` file or as a static library, so you can:
1) Download `chttp.c` and `chttp.h` from the repository (no need to close the project) 1) Download `chttp.c` and `chttp.h` from the repository (no need to clone the project)
2) or clone the project and build the static library my running 2) or clone the project and build the static library my running
@@ -13,7 +23,7 @@ The library is distributed in a single amalgamated `chttp.c` file or as a static
make libchttp.a make libchttp.a
``` ```
If you used the amalgamated files, this are the flags required to build a project with cHTTP: If you used the amalgamated files, these are the flags required to build a project with cHTTP:
```bash ```bash
# Linux # Linux
@@ -23,19 +33,17 @@ gcc your_app.c chttp.c
gcc your_app.c chttp.c -lws2_32 gcc your_app.c chttp.c -lws2_32
``` ```
If you are using the static library, instead if adding `chttp.c`, you will need to add the `-lchttp` flag. If you are using the static library, instead of adding `chttp.c`, you will need to add the `-lchttp` flag.
By defalt the library is build without HTTPS. To enable it, add the flags `-DHTTPS_ENABLED -lssl -lcrypto`. By default, the library is built without HTTPS. To enable it, add the flags `-DHTTPS_ENABLED -lssl -lcrypto`.
## Features & Limitations ```bash
# Linux + HTTPS
gcc your_app.c chttp.c -DHTTPS_ENABLED -lssl -lcrypto
* HTTP 1.1 client and server # Windows + HTTPS
* Fully non-blocking gcc your_app.c chttp.c -lws2_32 -DHTTPS_ENABLED -lssl -lcrypto
* Cross-Platform (Windows & Linux) ```
* HTTPS support (using OpenSSL)
* Virtual Hosts
* Single-threaded
* Zero-copy interface
## Example ## Example
@@ -98,5 +106,4 @@ cHTTP officially supports Linux and Windows.
Currently, HTTPS is implemented using OpenSSL which comes preinstalled on Linux but not Windows. It must be enabled by passing the `-DHTTPS_ENABLED` flag to gcc when building your program: Currently, HTTPS is implemented using OpenSSL which comes preinstalled on Linux but not Windows. It must be enabled by passing the `-DHTTPS_ENABLED` flag to gcc when building your program:
## Scalability ## Scalability
cHTTP is designed to reach moderate scale to allow a compact and easy to work with implementation. The non-blocking I/O is based on `poll()` which I would say works up to about 500 concurrent connections. If you have more than that, you should consider APIs like epoll, io_uring, cHTTP is designed to reach moderate scale to allow a compact and easy to work with implementation. The non-blocking I/O is based on `poll()` which I would say works up to about 500 concurrent connections. If you have more than that, you should consider APIs like epoll, io_uring, and I/O completion ports. If you do go that route, you can still reuse the cHTTP I/O independent core (see HTTP_Engine) to handle the HTTP protocol for you, both for client and server.
and I/O completion ports. If you do go that route, you can still reuse the cHTTP I/O independent core (see HTTP_Engine) to handle the HTTP protocol for you, both for client and server.