Address code review feedback for HTTP client and server
Based on code review feedback: Client improvements: - Remove redundant capacity check in http_client_get_builder (already verified num_conns < capacity) - Fix generation counter - no longer reset to zero when allocating connections, only incremented on request send - Add HTTP_Method parameter to http_request_builder_url instead of hardcoding GET method - Free connection resources when http_request_builder_send fails (invalid host mode or socket_connect failure) Server bug fix: - Fix ready queue indexing in http_server_next_request Changed: &server->conns[server->ready_head] To: &server->conns[server->ready[server->ready_head]] This bug would have caused incorrect connection retrieval All changes maintain consistency with the codebase style and improve robustness of error handling.
This commit is contained in:
+1
-1
@@ -240,7 +240,7 @@ bool http_server_next_request(HTTP_Server *server,
|
||||
if (server->num_ready == 0)
|
||||
return false;
|
||||
|
||||
HTTP_ServerConn *conn = &server->conns[server->ready_head];
|
||||
HTTP_ServerConn *conn = &server->conns[server->ready[server->ready_head]];
|
||||
server->ready_head = (server->ready_head + 1) % HTTP_SERVER_CAPACITY;
|
||||
server->num_ready--;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user