diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-05-10 20:18:38 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-05-10 20:20:28 -0400 |
commit | 3a9a3716c4f053067c4f558f284a6230a4e3c416 (patch) | |
tree | 62c8c1b6872a728726784a58aa58c81b58318f92 /src/response.c | |
parent | 01a9e3122778787fabcc97f71931ae3f9c3e2270 (diff) | |
download | lighttpd-git-3a9a3716c4f053067c4f558f284a6230a4e3c416.tar.gz |
[core] adjust r->http_host ptr caching
faster to use http_header_request_set_ptr() and buffer_copy_string_len()
than to use http_header_request_set() and http_header_request_get()
check r->http_host for NULL instead of relying on buffer_copy_* to do so
Diffstat (limited to 'src/response.c')
-rw-r--r-- | src/response.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/response.c b/src/response.c index ee35e101..ad35573c 100644 --- a/src/response.c +++ b/src/response.c @@ -630,8 +630,12 @@ static handler_t http_response_comeback (request_st * const r) config_reset_config(r); - buffer_copy_buffer(&r->uri.authority,r->http_host);/*copy even if NULL*/ - buffer_to_lower(&r->uri.authority); + if (__builtin_expect( (r->http_host != NULL), 1)) { + buffer_copy_buffer(&r->uri.authority, r->http_host); + buffer_to_lower(&r->uri.authority); + } + else + buffer_copy_string_len(&r->uri.authority, CONST_STR_LEN("")); int status = http_request_parse_target(r, r->con->proto_default_port); if (0 == status) { |