From 284551675d7596c6de9edbf488701395823e1d3c Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sun, 27 Sep 2026 22:11:04 +0200 Subject: http.c: Do not return partial if no file is set Whereas libweb does support returning partial transfers [1], it only does so limited to file transfers because it can be difficult or impossible to perform a partial request for what can be otherwise dynamically generated content. Previously, libweb naively accepted any range request from the client and silently replaced the response status to "206 Partial Content". [2] However, if no FILE * had been specified by the application, adjust_partial would treat this as a fatal error, because libweb assumed this as a programming error by the application. [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Range_requests [2]: https://en.wikipedia.org/wiki/HTTP_status#2xx_success --- http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'http.c') diff --git a/http.c b/http.c index 451ec88..a45372e 100644 --- a/http.c +++ b/http.c @@ -1693,7 +1693,7 @@ static int process_get(struct http_ctx *const h) w->op = c->op; ctx_free(c); - if (w->gr.state) + if (w->gr.state && r->f) w->r.status = HTTP_STATUS_PARTIAL_CONTENT; return start_response(h); -- cgit v1.2.3