2

I'm a newbie and I've been studying the Range request for byte serving. I found that a server has to send a byte-range as this

Content-Range: bytes 734-1233/1234

for the last byte range. But how would a browser get the last byte of the file when the request itself is till the last but one byte?

AmigoJack
  • 5,234
  • 1
  • 15
  • 31
Prajwal
  • 3,930
  • 5
  • 24
  • 50

1 Answers1

5

The current standard is RFC 7233. From 2.1 Byte Ranges:

The first-byte-pos value in a byte-range-spec gives the byte-offset
of the first byte in a range.  The last-byte-pos value gives the
byte-offset of the last byte in the range; that is, the byte
positions specified are inclusive.  Byte offsets start at zero.

Applying this to the the examples in 4.2 Content-Range:

The following are examples of Content-Range values in which the
selected representation contains a total of 1234 bytes:

o  The first 500 bytes:

     Content-Range: bytes 0-499/1234

Since the range is zero-based, 0 is the first byte and 499 is the 500th. So, 1233 is the final byte of a 1234-byte document.

Community
  • 1
  • 1
Joe
  • 29,416
  • 12
  • 68
  • 88