Put docindex-appending into an else-clause - quark - quark web server
(HTM) git clone git://git.suckless.org/quark
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 8afc6416647585ec2695d57eee7c226216e4111c
(DIR) parent deeec27c56d8f5049abac0dad3782f5daf95a1a3
(HTM) Author: Laslo Hunhold <dev@frign.de>
Date: Sun, 24 Jan 2021 21:35:11 +0100
Put docindex-appending into an else-clause
The previous if-branch leaves (goto, return) in all cases, making
no functional difference, but this improves the explicitness.
Signed-off-by: Laslo Hunhold <dev@frign.de>
Diffstat:
M http.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
---
(DIR) diff --git a/http.c b/http.c
@@ -760,11 +760,12 @@ http_prepare_response(const struct request *req, struct response *res,
S_FORBIDDEN : S_NOT_FOUND;
goto err;
}
- }
- /* copy the found index back to the final path */
- if (esnprintf(res->path, sizeof(res->path), "%s", tmpuri)) {
- s = S_REQUEST_TOO_LARGE;
- goto err;
+ } else {
+ /* docindex is valid, write tmpuri to response-path */
+ if (esnprintf(res->path, sizeof(res->path), "%s", tmpuri)) {
+ s = S_REQUEST_TOO_LARGE;
+ goto err;
+ }
}
}