summaryrefslogtreecommitdiff
path: root/src/response.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-03-24 21:39:08 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-04-02 01:16:40 -0400
commitdc01487ea6211337fbe632f0c8921d2efaa457eb (patch)
tree4c98f6237905fbba0c4b41b31da7eaacceecb3c8 /src/response.c
parentb4310877ac50c8c0cfa032debe1ca4011385f418 (diff)
downloadlighttpd-git-dc01487ea6211337fbe632f0c8921d2efaa457eb.tar.gz
[multiple] use buffer_append_* aggregates
reduces the number of round-trips into some frequently-called routines
Diffstat (limited to 'src/response.c')
-rw-r--r--src/response.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/response.c b/src/response.c
index c20834fe..b75c8bcf 100644
--- a/src/response.c
+++ b/src/response.c
@@ -148,12 +148,10 @@ http_response_write_header (request_st * const r)
buffer_append_string_len(b, tstr, 37);
}
- if (!light_btst(r->resp_htags, HTTP_HEADER_SERVER)) {
- if (!buffer_string_is_empty(r->conf.server_tag)) {
- buffer_append_string_len(b, CONST_STR_LEN("\r\nServer: "));
- buffer_append_string_len(b, CONST_BUF_LEN(r->conf.server_tag));
- }
- }
+ if (!light_btst(r->resp_htags, HTTP_HEADER_SERVER)
+ && !buffer_string_is_empty(r->conf.server_tag))
+ buffer_append_str2(b, CONST_STR_LEN("\r\nServer: "),
+ CONST_BUF_LEN(r->conf.server_tag));
buffer_append_string_len(b, CONST_STR_LEN("\r\n\r\n"));
@@ -714,7 +712,7 @@ http_response_static_errdoc (request_st * const r)
}
/* build default error-page */
- buffer * const b = r->tmp_buf;
+ buffer * const b = chunkqueue_append_buffer_open(&r->write_queue);
buffer_copy_string_len(b, CONST_STR_LEN(
"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
@@ -733,7 +731,7 @@ http_response_static_errdoc (request_st * const r)
"</h1>\n"
" </body>\n"
"</html>\n"));
- (void)http_chunk_append_mem(r, CONST_BUF_LEN(b));
+ chunkqueue_append_buffer_commit(&r->write_queue);
http_header_response_set(r, HTTP_HEADER_CONTENT_TYPE,
CONST_STR_LEN("Content-Type"),