aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-09-27 22:11:04 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-09-27 22:11:04 +0200
commit284551675d7596c6de9edbf488701395823e1d3c (patch)
treeac09ed3af128961d58d2ca3ed7aaacfef99919f3
parente8e9b1b129bc9a324e9df4a98d971505a2739a85 (diff)
downloadlibweb-0.6.0.tar.gz
http.c: Do not return partial if no file is setHEADv0.6.0master
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
-rw-r--r--http.c2
1 files changed, 1 insertions, 1 deletions
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);