summaryrefslogtreecommitdiff
path: root/src/response.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-05-07 16:14:14 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-05-07 16:39:52 -0400
commit325690b03952b670734eda46725f44b617780b9b (patch)
tree850669f9a4e6d4fc0b9962d5e12c2fc1cc0122a9 /src/response.c
parentf7bcc83355de4c6e767c6586d72d177e3b44493a (diff)
downloadlighttpd-git-325690b03952b670734eda46725f44b617780b9b.tar.gz
[core] mark cold paths in http_response_config
HTTP/1.1 is not typically disabled GET/HEAD are typically the most frequent request types and request body is not typically present for GET/HEAD
Diffstat (limited to 'src/response.c')
-rw-r--r--src/response.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/response.c b/src/response.c
index 2a557118..7e320ae8 100644
--- a/src/response.c
+++ b/src/response.c
@@ -323,12 +323,13 @@ static handler_t http_response_config (request_st * const r) {
config_patch_config(r);
/* do we have to downgrade from 1.1 to 1.0 ? (ignore for HTTP/2) */
- if (!r->conf.allow_http11 && r->http_version == HTTP_VERSION_1_1)
+ if (__builtin_expect( (!r->conf.allow_http11), 0)
+ && r->http_version == HTTP_VERSION_1_1)
r->http_version = HTTP_VERSION_1_0;
- /* r->conf.max_request_size is in kBytes */
- if (0 != r->conf.max_request_size &&
- (off_t)r->reqbody_length > ((off_t)r->conf.max_request_size << 10)) {
+ if (__builtin_expect( (r->reqbody_length > 0), 0)
+ && 0 != r->conf.max_request_size /* r->conf.max_request_size in kB */
+ && (off_t)r->reqbody_length > ((off_t)r->conf.max_request_size << 10)) {
log_error(r->conf.errh, __FILE__, __LINE__,
"request-size too long: %lld -> 413", (long long) r->reqbody_length);
return /* 413 Payload Too Large */