🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
3 messages
3 total messages Started by bugzilla-noreply Mon, 23 Nov 2026 18:49
[Bug 301055] libfetch: HTTP 206 reply to a request without Range is written as the whole file
#668
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 18:49
62 lines
3985 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301055

            Bug ID: 301055
           Summary: libfetch: HTTP 206 reply to a request without Range is
                    written as the whole file
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: laamalif@proton.me

If fetch doesn't send a Range header and the server answers 206 with a
Content-Range that doesn't start at 0, fetch writes the partial body as the
whole file and exits 0.

For example, with a server that replies

    HTTP/1.1 206 Partial Content
    Content-Range: bytes 3-9/10
    Content-Length: 7

`fetch -o out http://host/f` leaves a 7 byte file that starts at offset 3 of
the real file, and returns 0. I saw this on 15.1-RELEASE-p6 (arm64) with the
stock /usr/bin/fetch. The server log shows that the request had no Range
header.

http_request_body() has a "too far?" check for a reply that starts after the
requested offset, but it is skipped when the requested offset is 0. After the
first reply, URL->offset holds the reply's start (3), so fetch.c thinks it was
a resume that failed, resets the offset to 0 and sends the same GET again. The
second reply is the same 206, the check is skipped again, and the body is
written.

With no offset the reply may start at 0 and no later, so the check can always
run. The attached patch drops the "URL->offset > 0 &&". With it the same server
gives "Protocol error", exit 1, and one connection instead of two. `-r` is not
affected: resuming from a 3 byte file with a 206 starting at 3 still appends.

I don't have a real server that does this unasked, so I don't know how often it
matters. It looked wrong while reading the code.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301055] libfetch: HTTP 206 reply to a request without Range is written as the whole file
#669
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 18:49
16 lines
2500 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301055

--- Comment #1 from laamalif@proton.me ---
Created attachment 277609
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277609&action=edit
Check the start of a 206 reply even when no offset was requested

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301055] libfetch: HTTP 206 reply to a request without Range is written as the whole file
#672
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 20:18
16 lines
2528 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301055

Mark Linimon <linimon@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|bugs@FreeBSD.org            |des@FreeBSD.org

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads