Skip to content

Commit

Permalink
Make request_buffer_size be at least DEFAULT_BUFFER_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
lpereira committed Apr 15, 2024
1 parent 313f2e5 commit 7ea760e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/lib/lwan.c
Expand Up @@ -653,17 +653,16 @@ static bool setup_from_config(struct lwan *lwan, const char *path)
long request_buffer_size = parse_long(
line->value, (long)default_config.request_buffer_size);

if (request_buffer_size < 0) {
config_error(conf, "Negative request buffer size requested");
} else if (request_buffer_size > 16 * (1 << 20)) {
if (request_buffer_size > 16 * (1 << 20)) {
config_error(conf,
"Request buffer can't be over 16MiB");
} else if (request_buffer_size < DEFAULT_BUFFER_SIZE) {
lwan_status_warning("Request buffer size of %ld is smaller than the "
"recommended minimum of %d bytes. This might not "
"be sufficient!",
request_buffer_size,
DEFAULT_BUFFER_SIZE);
lwan_status_warning("Using request buffer size of %d bytes instead of the "
"requested %ld bytes",
DEFAULT_BUFFER_SIZE,
request_buffer_size);

request_buffer_size = DEFAULT_BUFFER_SIZE;
}

lwan->config.request_buffer_size = (size_t)request_buffer_size;
Expand Down

0 comments on commit 7ea760e

Please sign in to comment.