-/* $OpenBSD: server_file.c,v 1.68 2020/05/22 07:18:17 bentley Exp $ */
+/* $OpenBSD: server_file.c,v 1.69 2021/03/16 06:44:14 otto Exp $ */
/*
* Copyright (c) 2006 - 2017 Reyk Floeter <reyk@openbsd.org>
struct media_type *media;
const char *errstr = NULL;
int fd = -1, ret, code = 500;
+ size_t bufsiz;
if ((ret = server_file_method(clt)) != 0) {
code = ret;
goto fail;
}
- /* Adjust read watermark to the socket output buffer size */
+ /* Adjust read watermark to the optimal file io size */
+ bufsiz = MAXIMUM(st->st_blksize, 64 * 1024);
bufferevent_setwatermark(clt->clt_srvbev, EV_READ, 0,
- clt->clt_sndbufsiz);
+ bufsiz);
bufferevent_settimeout(clt->clt_srvbev,
srv_conf->timeout.tv_sec, srv_conf->timeout.tv_sec);
struct media_type *media, multipart_media;
struct range_data *r = &clt->clt_ranges;
struct range *range;
- size_t content_length = 0;
+ size_t content_length = 0, bufsiz;
int code = 500, fd = -1, i, nranges, ret;
char content_range[64];
const char *errstr = NULL;
goto fail;
}
- /* Adjust read watermark to the socket output buffer size */
+ /* Adjust read watermark to the optimal file io size */
+ bufsiz = MAXIMUM(st->st_blksize, 64 * 1024);
bufferevent_setwatermark(clt->clt_srvbev, EV_READ, 0,
- clt->clt_sndbufsiz);
+ bufsiz);
bufferevent_settimeout(clt->clt_srvbev,
srv_conf->timeout.tv_sec, srv_conf->timeout.tv_sec);