• Sina Siadat's avatar
    net/http: send Content-Range if no byte range overlaps · aa9b3d70
    Sina Siadat authored
    RFC 7233, section 4.4 says:
    >>>
    For byte ranges, failing to overlap the current extent means that the
    first-byte-pos of all of the byte-range-spec values were greater than the
    current length of the selected representation.  When this status code is
    generated in response to a byte-range request, the sender SHOULD generate a
    Content-Range header field specifying the current length of the selected
    representation
    <<<
    
    Thus, we should send the Content-Range only if none of the ranges
    overlap.
    
    Fixes #15798.
    
    Change-Id: Ic9a3e1b3a8730398b4bdff877a8f2fd2e30149e3
    Reviewed-on: https://go-review.googlesource.com/24212
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    aa9b3d70
fs_test.go 29.8 KB