Fix web server hanging issues

Fixed two bugs in the HTTP server that could cause hangs:

1. web/chttp.c:4060 - Fixed incorrect error buffer check
   - Was checking output buffer for errors after a read operation
   - Should check input buffer instead
   - This could cause the server to miss read errors and not close
     bad connections properly

2. web/main.c:334 - Added loop to process multiple queued requests
   - Previously only processed one request per event loop iteration
   - Now processes all queued requests before returning to poll()
   - This prevents requests from being stuck in the queue when the
     socket is in ESTABLISHED_READY state

These fixes improve the server's ability to handle multiple requests
on Keep-Alive connections.
This commit is contained in:
Claude
2025-11-23 09:48:07 +01:00
committed by cozis
parent e99c574767
commit 3b0ef325fa
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -4057,7 +4057,7 @@ http_server_conn_process_events(HTTP_Server *server, HTTP_ServerConn *conn)
byte_queue_write_ack(&conn->input, num);
if (byte_queue_error(&conn->output)) {
if (byte_queue_error(&conn->input)) {
socket_close(&server->sockets, conn->handle);
} else {
check_request_buffer(server, conn);