aboutsummaryrefslogtreecommitdiff
path: root/networking/httpd.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-10-13 14:37:51 +0100
committerRon Yorston <rmy@pobox.com>2021-10-13 14:37:51 +0100
commit0ecf1aea459571b48dc68ddc2b7b9265740fa960 (patch)
tree491d6184a44b8b525a4ca35759d622aecd7f6344 /networking/httpd.c
parent4859ddcb20616718efbea12c6bf8b27c469b68de (diff)
parentaaf3d5ba74c5da97ff80b61f30cb8dd225d39096 (diff)
downloadbusybox-w32-0ecf1aea459571b48dc68ddc2b7b9265740fa960.tar.gz
busybox-w32-0ecf1aea459571b48dc68ddc2b7b9265740fa960.tar.bz2
busybox-w32-0ecf1aea459571b48dc68ddc2b7b9265740fa960.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'networking/httpd.c')
-rw-r--r--networking/httpd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 71e3a723f..6cc189272 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -281,7 +281,7 @@
281//usage: IF_NOT_PLATFORM_MINGW32( 281//usage: IF_NOT_PLATFORM_MINGW32(
282//usage: "\n -i Inetd mode" 282//usage: "\n -i Inetd mode"
283//usage: ) 283//usage: )
284//usage: "\n -f Don't daemonize" 284//usage: "\n -f Run in foreground"
285//usage: "\n -v[v] Verbose" 285//usage: "\n -v[v] Verbose"
286//usage: "\n -p [IP:]PORT Bind to IP:PORT (default *:"STR(CONFIG_FEATURE_HTTPD_PORT_DEFAULT)")" 286//usage: "\n -p [IP:]PORT Bind to IP:PORT (default *:"STR(CONFIG_FEATURE_HTTPD_PORT_DEFAULT)")"
287//usage: IF_FEATURE_HTTPD_SETUID( 287//usage: IF_FEATURE_HTTPD_SETUID(
@@ -1918,14 +1918,17 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
1918 send_headers(HTTP_OK); 1918 send_headers(HTTP_OK);
1919#if ENABLE_FEATURE_USE_SENDFILE 1919#if ENABLE_FEATURE_USE_SENDFILE
1920 { 1920 {
1921 off_t offset = (range_start < 0) ? 0 : range_start; 1921 off_t offset;
1922 if (range_start < 0)
1923 range_start = 0;
1924 offset = range_start;
1922 while (1) { 1925 while (1) {
1923 /* sz is rounded down to 64k */ 1926 /* sz is rounded down to 64k */
1924 ssize_t sz = MAXINT(ssize_t) - 0xffff; 1927 ssize_t sz = MAXINT(ssize_t) - 0xffff;
1925 IF_FEATURE_HTTPD_RANGES(if (sz > range_len) sz = range_len;) 1928 IF_FEATURE_HTTPD_RANGES(if (sz > range_len) sz = range_len;)
1926 count = sendfile(STDOUT_FILENO, fd, &offset, sz); 1929 count = sendfile(STDOUT_FILENO, fd, &offset, sz);
1927 if (count < 0) { 1930 if (count < 0) {
1928 if (offset == range_start) 1931 if (offset == range_start) /* was it the very 1st sendfile? */
1929 break; /* fall back to read/write loop */ 1932 break; /* fall back to read/write loop */
1930 goto fin; 1933 goto fin;
1931 } 1934 }