summaryrefslogtreecommitdiff
path: root/src/mod_staticfile.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2015-02-08 19:10:36 +0000
committerStefan Bühler <stbuehler@web.de>2015-02-08 19:10:36 +0000
commit1be163b44a53eebb0a7b0ed562d12e3f252794e1 (patch)
tree866d5ec78d878fc24c209a9b95b7ab0edf1f6540 /src/mod_staticfile.c
parent6afad87d2ed66a48cda2a7c01dbcc59023774b73 (diff)
downloadlighttpd-git-1be163b44a53eebb0a7b0ed562d12e3f252794e1.tar.gz
Remove chunkqueue_get_{append,prepend}* API
Although those were "easy" to use, they violated the abstraction: content of the chunkqueue should only be modified via the API. Replace with chunkqueue_get_memory() and chunkqueue_use_memory() for functions that read data from network (reusing large buffers), chunkqueue_steal_with_tempfiles() to store request bodies on disk temporarily. Modules that were generating content and need a buffer maintain the buffer manually (have to be careful to free the buffer on errors, as it isn't part of the chunkqueue yet). From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2976 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/mod_staticfile.c')
-rw-r--r--src/mod_staticfile.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c
index 931bc570..e36c6973 100644
--- a/src/mod_staticfile.c
+++ b/src/mod_staticfile.c
@@ -285,9 +285,7 @@ static int http_response_parse_range(server *srv, connection *con, plugin_data *
if (!error) {
if (multipart) {
/* write boundary-header */
- buffer *b;
-
- b = chunkqueue_get_append_buffer(con->write_queue);
+ buffer *b = buffer_init();
buffer_copy_string_len(b, CONST_STR_LEN("\r\n--"));
buffer_append_string(b, boundary);
@@ -307,7 +305,8 @@ static int http_response_parse_range(server *srv, connection *con, plugin_data *
buffer_append_string_len(b, CONST_STR_LEN("\r\n\r\n"));
con->response.content_length += b->used - 1;
-
+ chunkqueue_append_buffer(con->write_queue, b);
+ buffer_free(b);
}
chunkqueue_append_file(con->write_queue, con->physical.path, start, end - start + 1);
@@ -320,15 +319,15 @@ static int http_response_parse_range(server *srv, connection *con, plugin_data *
if (multipart) {
/* add boundary end */
- buffer *b;
-
- b = chunkqueue_get_append_buffer(con->write_queue);
+ buffer *b = buffer_init();
buffer_copy_string_len(b, "\r\n--", 4);
buffer_append_string(b, boundary);
buffer_append_string_len(b, "--\r\n", 4);
con->response.content_length += b->used - 1;
+ chunkqueue_append_buffer(con->write_queue, b);
+ buffer_free(b);
/* set header-fields */