From 4b1264cb26a481faf8448322ebb19b8993ae6aaf Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 30 Oct 2026 13:16:16 +0100 Subject: Don't treat a full send buffer as an error when sending http. Retry later --- ot_http.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ot_http.c b/ot_http.c index d4c7363..e8ba3da 100644 --- a/ot_http.c +++ b/ot_http.c @@ -6,6 +6,7 @@ /* System */ #define _GNU_SOURCE #include +#include #include #include #include @@ -85,6 +86,12 @@ static void http_senddata(const int64_t sock, struct ot_workstruct *ws) { buf_reset(&cookie->request); written_size = write(sock, ws->reply, ws->reply_size); + /* A send buffer with no room in it is not a failure: nothing went out, so + the whole reply goes into the batch below and leaves when the socket + drains. Only a real error ends the connection here. */ + if (written_size < 0 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) + written_size = 0; + if ((written_size < 0) || ((written_size == ws->reply_size) && !ws->keep_alive)) { http_close(sock); return; -- cgit v1.3