Glenn Strauss
1d6003e575
[core] mark some chunk.c funcs as pure
2020-07-08 19:54:29 -04:00
Glenn Strauss
9914bb297b
[core] C99 restrict on some base funcs
...
buffer.[ch], chunk.[ch], request.[ch], sock_addr.[ch]
2020-07-08 19:54:29 -04:00
Glenn Strauss
304e46d4f8
[core] default chunk size 8k (was 4k)
2020-07-08 19:54:28 -04:00
Glenn Strauss
de73b190a4
[core] read up-to fixed size chunk before fionread
2020-07-08 19:54:28 -04:00
Glenn Strauss
0fcd51438d
[core] create http chunk header on the stack
...
streamline code in http_chunk.c
2020-07-08 19:54:28 -04:00
Glenn Strauss
010c28949c
[multiple] prefer (connection *) to (srv *)
...
convert all log_error_write() to log_error() and pass (log_error_st *)
use con->errh in preference to srv->errh (even though currently same)
avoid passing (server *) when previously used only for logging (errh)
2020-07-08 19:54:28 -04:00
Glenn Strauss
ed62e354ff
[core] use config_plugin_values_init()
2020-07-08 18:08:51 -04:00
Glenn Strauss
601c572c39
[core] inline buffer as part of data_string value
...
(instead of value being (buffer *))
2020-02-24 11:15:32 -05:00
Glenn Strauss
5c0c4936b4
[core] __attribute_returns_nonnull__
2020-02-24 11:15:32 -05:00
Glenn Strauss
2ad92d17a1
[core] chunkqueue_compact_mem()
2020-02-24 11:14:45 -05:00
Glenn Strauss
d9e2dd4b2e
[core] chunkqueue perf: specialized buffer.h funcs
2019-05-13 20:27:49 -04:00
Glenn Strauss
6572976e06
[core] chunkqueue perf: code reuse
...
code reuse, simplification, and inlining
remove excess calls to chunkqueue_remove_finished_chunks()
(it may still be possible for there to be an empty chunk in chunkqueue
if nothing were written to a temporary file (need to verify this), so
preserve some calls to chunkqueue_remove_finished_chunks() for now)
2019-05-13 20:27:49 -04:00
Glenn Strauss
599b4f05c8
[core] fix 1.4.52 regression in mem use with POST ( fixes #2948 )
...
(thx rgenoud)
x-ref:
"[regression][Bisected] lighttpd uses way more memory with POST since 1.4.52"
https://redmine.lighttpd.net/issues/2948
2019-04-20 02:06:43 -04:00
Glenn Strauss
f2ac4cdfc5
[core] off_t upload_temp_file_size
2019-03-16 01:39:59 -04:00
Glenn Strauss
a78404cfbf
[core] fdevent_mkstemp_append() (shared)
2019-03-16 01:38:29 -04:00
Glenn Strauss
37bd124ae4
[core] pass conf.follow_symlink in more places
2019-03-10 23:22:58 -04:00
Glenn Strauss
c83fff1dda
[core] release empty chunk buf when nothing read
2019-03-07 00:32:17 -05:00
Glenn Strauss
a1b527e473
[multiple] reduce initial buffer sz if large POST ( fixes #2922 )
...
reduce initial buffer size if large POST to backend stored in temp files
regression in lighttpd 1.4.52
(thx rgenoud)
x-ref:
"[regression] lighttpd gets killed after uploading a big file"
https://redmine.lighttpd.net/issues/2922
2018-12-12 20:00:07 -05:00
Glenn Strauss
77c01f9817
[core] buffer_append_path_len()
...
concatenate paths, placing single '/' between strings
reverts broken commit:b9402283
(thx avij)
2018-11-28 02:12:41 -05:00
Glenn Strauss
f69bd9cdb8
[core] perf: simple, quick buffer_clear()
...
quickly clear buffer instead of buffer_string_set_length(b, 0) or
buffer_reset(b). Avoids free() of large buffers about to be reused,
or buffers that are module-scoped, persistent, and reused.
(buffer_reset() should still be used with buffers in connection *con
when the data in the buffers is supplied by external, untrusted source)
2018-11-23 00:37:38 -05:00
Glenn Strauss
9749503b1d
[core] separate func to reset FILE_CHUNK
2018-11-21 00:23:40 -05:00
Glenn Strauss
758c58cda5
[core] clear chunk buffer upon release
...
(before adding back to reusable buffer pool)
2018-11-18 17:02:06 -05:00
Glenn Strauss
70d7d0a0a1
[core] server.chunkqueue-chunk-sz = 4096
...
server.chunkqueue-chunk-sz = 4096 (default)
Can be configured any integral value greater than 0.
Value is rounded up to next 1024 if not an even multiple of 1k.
Sites with large request or response headers may benefit from
an 8k or 16k chunk size. Embedded systems might choose to minimize
memory use by using a 1k chunk size.
2018-11-17 23:53:50 -05:00
Glenn Strauss
88ee73d0a2
[multiple] perf: simplify chunkqueue_get_memory()
2018-11-12 23:01:34 -05:00
Glenn Strauss
f512bfa4af
[core] use chunk_buf_sz instead of hard-coded num
2018-11-12 21:56:05 -05:00
Glenn Strauss
1539cbfdc1
[core] perf: chunkqueue buffers already sized up
...
provide new interface for sizing to even larger if very large request
(chunkqueue_prepend_buffer_open_sz())
2018-11-12 21:56:05 -05:00
Glenn Strauss
8c0792a58c
[multiple] better packing of struct chunk
...
remove c->file.name
previous commit modified c->file.name to share buffer with c->mem
2018-11-12 21:56:05 -05:00
Glenn Strauss
fccc7fc607
[core] perf: chunk.c chunk pool
...
reuse chunks across chunkqueues; remove cq->unused, cq->unused_chunks
reuse same buffer c->mem and c->file.name in chunk
2018-11-12 08:25:28 -05:00
Glenn Strauss
a9ae35128d
[core] chunk.c code reuse
2018-10-28 10:00:03 -04:00
Glenn Strauss
40d3408328
[core] perf: append response directly into write q
...
prepend non-dynamic response directly into write queue chunkqueue
2018-10-28 02:38:10 -04:00
Glenn Strauss
59a71815dc
[core] perf: copy small strings; extend last chunk
...
copy small strings; extend last chunk
(instead of creating new, tiny chunk)
2018-10-28 02:38:06 -04:00
Glenn Strauss
23c72fc606
[core] perf: prepend headers directly into write q
...
prepend response headers directly into write queue chunkqueue
2018-10-27 14:00:08 -04:00
Glenn Strauss
5a159e828d
[core] perf: size write buffers for reuse
...
size write buffers for reuse in common cases
(so that write buffers are BUFFER_MAX_REUSE_SIZE)
2018-10-27 11:40:57 -04:00
Glenn Strauss
bed3779617
[core] fix segfault if tempdirs fill up ( fixes #2843 )
...
(thx wolfram)
x-ref:
"lighttpd segfault if /var/tmp is full"
https://redmine.lighttpd.net/issues/2843
2017-11-26 17:03:07 -05:00
Glenn Strauss
f22b5d69da
[core] inline chunkqueue_is_empty()
2017-10-09 02:45:12 -04:00
Glenn Strauss
9bc61f16cb
[core] attempt to quiet coverity false positives
2017-08-12 15:39:12 -04:00
Glenn Strauss
685cab057e
[core] rename fd_close_on_exec()
...
rename fd_close_on_exec() to fdevent_setfd_cloexec()
2017-07-15 22:42:15 -04:00
Glenn Strauss
162e754d0d
[core] report file path when mkstemp() fails ( fixes #2802 )
...
x-ref:
"Could the error-log be improved a tiny bit in regards to "Permission denied" errors"
https://redmine.lighttpd.net/issues/2802
2017-03-28 02:17:33 -04:00
Glenn Strauss
ba953cdf45
[core] include "fdevent.h" where needed
...
(instead of providing #include "fdevent.h" in base.h)
2017-03-28 02:17:33 -04:00
Glenn Strauss
a53f662a30
[core] remove some unused header includes
...
remove exposure of stdio.h in buffer.h for print_backtrace(), now static
2017-03-28 02:17:33 -04:00
Glenn Strauss
b0c66266d9
[core] initialize globals at top of main()
...
initialize globals (including file-scoped static globals) at top of main
2017-01-31 14:40:05 -05:00
Glenn Strauss
4364a4e029
[core] move network_open_file_chunk() to chunk.c
...
move network_open_file_chunk() to chunk.c:chunkqueue_open_file_chunk()
for reuse from modules
2017-01-14 01:06:16 -05:00
Glenn Strauss
06cc3dfa59
[core] check fcntl O_APPEND succeeds w/ mkstemp()
2016-10-29 10:32:41 -04:00
Glenn Strauss
204df06814
minor: coverity comments
2016-10-29 09:14:07 -04:00
Glenn Strauss
23503883ba
[core] fix potential streaming tempfile corruption ( fixes #2760 )
...
set O_APPEND after mkstemp() in chunk.c (mkostemp() is not as portable)
(also set FD_CLOEXEC to avoid potentially leaking open tempfiles to CGI)
(thx dieter.ro for helping track this down)
x-ref:
https://redmine.lighttpd.net/boards/3/topics/6884
"potential tempfile corruption when streaming response"
https://redmine.lighttpd.net/issues/2760
2016-10-29 09:14:07 -04:00
Glenn Strauss
8047c2f448
fix errors detected by Coverity Scan
...
fix potential NULL pointer dereference in mod_deflate.c
remove logically dead code in connection-glue.c
add coverity annotations to see if some issues will be reclassified
2016-09-23 09:09:57 -04:00
Glenn Strauss
c8e647ad31
[core] set chunkqueue tempdirs at startup
...
If server.upload-dirs is not configured, then attempt to use TMPDIR
from the environment, if set, or else use /tmp. Warn at startup if
tempdirs are not present.
2016-07-28 03:57:52 -04:00
Glenn Strauss
72b133f595
fix errors detected by Coverity Scan
...
buffer.c:itostr() undefined behavior taking modulus of negative number
additional minor code changes made to quiet other coverity warnings
(false positives)
2016-06-23 03:57:19 -04:00
Glenn Strauss
1a18669d53
chunkqueue_append_chunkqueue()
...
(simpler than chunkqueue_steal() for transferring entire chunkqueue)
2016-06-21 15:33:18 -04:00
Glenn Strauss
879a282de7
fix errors detected by Coverity Scan
...
fd leak in mod_dirlisting.c
use after free in error condition in mod_proxy.c
NULL pointer dereference in error message in chunk.c
additional minor code changes made to quiet other coverity warnings
2016-06-21 03:53:50 -04:00