From af55803d0dff9eb692c760c8d486e736c945061d Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Sat, 27 Jun 2026 00:58:05 +0200 Subject: chore: clean up comment formatting and wording --- tools/server/http.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'tools/server/http.c') diff --git a/tools/server/http.c b/tools/server/http.c index a1d347f..6fc21f0 100644 --- a/tools/server/http.c +++ b/tools/server/http.c @@ -1,3 +1,16 @@ +/* HTTP/1.1 connection lifecycle, header parsing, and response framing. + * + * - One refcounted client per connection. + * - The event loop holds a reference while the socket is open; the worker thread + * holds one while a job from that connection is in flight. + * - If a request completes after the peer disconnects, the client is still freed + * safely. + * - read_cb accumulates bytes until a full request is framed, then hands it to + * dispatch_request in server.c. + * - write_cb drains the response, then either closes the connection or arms the + * next pipelined request. + */ + #include "server_internal.h" #include "util.h" @@ -11,17 +24,6 @@ #include #include -/* ======================================================================== - * HTTP/1.1 connection lifecycle, header parsing, and response framing - * - * One client per connection, refcounted: the event loop holds a reference - * while the socket is open and the worker thread holds one while a job derived - * from the connection is in flight, so a request that completes after the peer - * disconnects frees the client safely. read_cb accumulates bytes until a full - * request is framed, then hands off to dispatch_request (server.c); write_cb - * drains the response and either closes or arms the next pipelined request. - * ======================================================================== */ - int set_nonblock(int fd) { int flags = fcntl(fd, F_GETFL, 0); if (flags < 0) -- cgit v1.3.1