]> Cypherpunks repositories - gostls13.git/commit
net/http: send Content-Range if no byte range overlaps
authorSina Siadat <siadat@gmail.com>
Fri, 17 Jun 2016 16:32:59 +0000 (21:02 +0430)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 25 Aug 2016 17:52:35 +0000 (17:52 +0000)
commitaa9b3d70142afb75a510c2c92b8c387fce10b2c9
treef149e851f6be5b442f76e870548ebd41aa90aed7
parent0bc94a8864f0cb8392c094f58dd84d28a06f35d5
net/http: send Content-Range if no byte range overlaps

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: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/fs.go
src/net/http/fs_test.go
src/net/http/range_test.go