Browse Source

[core] remove server.upload-temp-file-size limit

previously undocumented server.upload-temp-file-size in lighttpd 1.4.38
preceded introduction of lighttpd streaming options in lighttpd 1.4.40
(server.stream-request-body and server.stream-response-body)
master
Glenn Strauss 2 months ago
parent
commit
bd72d1927a
  1. 24
      src/chunk.c
  2. 1
      src/chunk.h
  3. 6
      src/mod_cgi.c
  4. 3
      src/mod_webdav.c

24
src/chunk.c

@ -21,9 +21,8 @@
#include <errno.h>
#include <string.h>
/* default 1MB, upper limit 128MB */
/* default 1 MB */
#define DEFAULT_TEMPFILE_SIZE (1 * 1024 * 1024)
#define MAX_TEMPFILE_SIZE (128 * 1024 * 1024)
static size_t chunk_buf_sz = 8192;
static chunk *chunks, *chunks_oversized;
@ -509,21 +508,18 @@ void chunkqueue_update_file(chunkqueue * const restrict cq, chunk *c, off_t len)
}
void chunkqueue_set_tempdirs_default (const array *tempdirs, off_t upload_temp_file_size) {
chunkqueue_default_tempdirs = tempdirs;
chunkqueue_default_tempfile_size
= (0 == upload_temp_file_size) ? DEFAULT_TEMPFILE_SIZE
: (upload_temp_file_size > MAX_TEMPFILE_SIZE) ? MAX_TEMPFILE_SIZE
: upload_temp_file_size;
if (upload_temp_file_size == 0)
upload_temp_file_size = DEFAULT_TEMPFILE_SIZE;
chunkqueue_default_tempdirs = tempdirs;
chunkqueue_default_tempfile_size = upload_temp_file_size;
}
void chunkqueue_set_tempdirs(chunkqueue * const restrict cq, const array * const restrict tempdirs, off_t upload_temp_file_size) {
force_assert(NULL != cq);
cq->tempdirs = tempdirs;
cq->upload_temp_file_size
= (0 == upload_temp_file_size) ? DEFAULT_TEMPFILE_SIZE
: (upload_temp_file_size > MAX_TEMPFILE_SIZE) ? MAX_TEMPFILE_SIZE
: upload_temp_file_size;
cq->tempdir_idx = 0;
if (upload_temp_file_size == 0)
upload_temp_file_size = chunkqueue_default_tempfile_size;
cq->tempdirs = tempdirs;
cq->upload_temp_file_size = upload_temp_file_size;
cq->tempdir_idx = 0;
}
static void chunkqueue_dup_file_chunk_fd (chunk * const restrict d, const chunk * const restrict c) {

1
src/chunk.h

@ -76,7 +76,6 @@ void chunkqueue_set_tempdirs_default_reset (void);
__attribute_cold__
void chunkqueue_set_tempdirs_default (const array *tempdirs, off_t upload_temp_file_size);
__attribute_cold__
void chunkqueue_set_tempdirs(chunkqueue * restrict cq, const array * restrict tempdirs, off_t upload_temp_file_size);
void chunkqueue_append_file(chunkqueue * restrict cq, const buffer * restrict fn, off_t offset, off_t len); /* copies "fn" */

6
src/mod_cgi.c

@ -887,11 +887,7 @@ URIHANDLER_FUNC(cgi_is_handled) {
&& !(r->conf.stream_request_body /*(if not streaming request body)*/
& (FDEVENT_STREAM_REQUEST|FDEVENT_STREAM_REQUEST_BUFMIN))) {
/* store request body in single tempfile if not streaming request body*/
chunkqueue * const cq = &r->reqbody_queue;
chunkqueue_set_tempdirs(cq, cq->tempdirs, INTMAX_MAX);
/* force huge cq->upload_temp_file_size since chunkqueue_set_tempdirs()
* might truncate upload_temp_file_size to chunk.c:MAX_TEMPFILE_SIZE */
cq->upload_temp_file_size = INTMAX_MAX;
r->reqbody_queue.upload_temp_file_size = INTMAX_MAX;
}
{

3
src/mod_webdav.c

@ -4451,9 +4451,6 @@ mod_webdav_put_prep (request_st * const r, const plugin_config * const pconf)
force_assert(cq->last);
#endif
buffer_clear(cq->last->mem); /* file already unlink()ed */
chunkqueue_set_tempdirs(cq, cq->tempdirs, INTMAX_MAX);
/* force huge cq->upload_temp_file_size since chunkqueue_set_tempdirs()
* might truncate upload_temp_file_size to chunk.c:MAX_TEMPFILE_SIZE */
cq->upload_temp_file_size = INTMAX_MAX;
cq->last->file.is_temp = 1;

Loading…
Cancel
Save