[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH 1/1] httpd: fix offset for sendfile
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2020-12-29 23:06:33
Message-ID: CAK1hOcPJ_4-SDJswbzmxicBp18D8wv=uE6Q3zjwqn0Te4mW9eg () mail ! gmail ! com
[Download RAW message or body]

Applied, thank you

On Tue, Dec 29, 2020 at 4:29 PM Maxim Storchak <m.storchak@gmail.com> wrote:
>
> If the Range: header is not present it the request,
> the offset passed to sendfile is wrong,
> and httpd falls back to the read-write loop.
>
> Signed-off-by: Maxim Storchak <m.storchak@gmail.com>
> ---
>  networking/httpd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/networking/httpd.c b/networking/httpd.c
> index 4346141ee..cc9828e78 100644
> --- a/networking/httpd.c
> +++ b/networking/httpd.c
> @@ -1871,7 +1871,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
>                 send_headers(HTTP_OK);
>  #if ENABLE_FEATURE_USE_SENDFILE
>         {
> -               off_t offset = range_start;
> +               off_t offset = (range_start==-1)?0:range_start;
>                 while (1) {
>                         /* sz is rounded down to 64k */
>                         ssize_t sz = MAXINT(ssize_t) - 0xffff;
> --
> 2.28.0
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic