Update README
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
(The following are thoughts that came to mind that I didn't have the time to add to docs but don't want to forget.)
|
||||
|
||||
The immediate mode API allows writing directly to the library's output buffer avoiding intermediate allocations
|
||||
@@ -1,13 +1,15 @@
|
||||
# chttp
|
||||
# cHTTP
|
||||
|
||||
chttp is an HTTP client & server library for C.
|
||||
This is an HTTP client and server library for C.
|
||||
|
||||
# Use Cases
|
||||
|
||||
cHTTP is perfect for tooling or production environments of limited scale (up to about 1000 concurrent connections). To scale it further, users can take cHTTP's I/O independant HTTP state machine and use it in conjunction with more scalable I/O solutions (see examples/engine).
|
||||
|
||||
## Why another HTTP library?
|
||||
|
||||
This is my attempt at solving the "HTTP problem" for the C language. Writing C programs that behave as or interact with web services is always more painful than necessary in C. You either need to use `libcurl` which is overkill in most situations or link a large scale web servers to serve simple pages. This library targets smaller scale use-cases and tries to be as nice as possible to work with. Even then, it is fast. No performance is left on the table unless there is a specific reason. And if you do want to work at larger scales by using more sophisticate I/O systems (io_uring, I/O completion ports, etc) you can reuse the core state machine of the library that is I/O independant.
|
||||
|
||||
I would be comfortable with chttp handling up to 1000 simultaneous connections. For anything more than that I would reuse chttp's I/O independant state machine with my own multi-threaded and more scalable I/O.
|
||||
|
||||
## Features & Limitations
|
||||
* HTTP/1.1 server & client
|
||||
* Cross-platform (Windows & Linux)
|
||||
|
||||
@@ -7,4 +7,6 @@ Make it cross-platform
|
||||
Find a way to compile OpenSSL on windows
|
||||
handle 3xx client redirections
|
||||
add discussion on string management
|
||||
add discussion on error management
|
||||
add discussion on error management
|
||||
check that virtual hosts over HTTPS work
|
||||
add examples for the router
|
||||
+2
-4
@@ -732,15 +732,13 @@ void socket_free(Socket *sock) {
|
||||
}
|
||||
}
|
||||
|
||||
#define COUNT(X) (sizeof(X) / sizeof((X)[0]))
|
||||
|
||||
int socket_wait(Socket **socks, int num_socks)
|
||||
int socket_wait(Socket **socks, int num_socks) // TODO: is this used?
|
||||
{
|
||||
if (num_socks <= 0)
|
||||
return -1;
|
||||
|
||||
struct pollfd polled[100]; // TODO: make this value configurable
|
||||
if (num_socks > (int) COUNT(polled))
|
||||
if (num_socks > (int) HTTP_COUNT(polled))
|
||||
return -1;
|
||||
|
||||
for (;;) {
|
||||
|
||||
Reference in New Issue
Block a user