Currently there is no elegant way to seek through data stream, except using range headers manually. So I purpose adding AsyncSeek, that would provide seek method on body reader. The seek method would fail if response contains Accept-Ranges: none. In other cases the reader would actually send new request with appropriate Range header.
On SeekFrom::Start(x) the range header should look like Range: bytes={x}-, so the reader can read till the end of stream normally.
For SeekFrom::Current(x) is similar to upper example: Range: bytes={c+x}-; where c is current stream position.
For SeekFrom::End(x) we just get the last x bytes: Range: bytes=-{x}.
Currently there is no elegant way to seek through data stream, except using range headers manually. So I purpose adding
AsyncSeek
, that would provide seek method on body reader. The seek method would fail if response containsAccept-Ranges: none
. In other cases the reader would actually send new request with appropriateRange
header.On
SeekFrom::Start(x)
the range header should look likeRange: bytes={x}-
, so the reader can read till the end of stream normally. ForSeekFrom::Current(x)
is similar to upper example:Range: bytes={c+x}-
; where c is current stream position. ForSeekFrom::End(x)
we just get the last x bytes:Range: bytes=-{x}
.