4.4. 416 Range Not Satisfiable

1 阅读1分钟

4.4. 416 Range Not Satisfiable

rfc 7233 4.4. 416 Range Not Satisfiable

返回416的时机

  • 没有overlap
  • 满足特定条件被rejected

For byte ranges, failing to overlap(TODO)

   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..

要想满足“failing to overlap”,只需要所有的byte-range-spec满足:

  • first-byte-pos > current length - 1

但是上述节选中却说的是满足:

  • first-byte-pos > current length

SHOULD

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 (Section 4.2)

Note

 Note: Because servers are free to ignore Range, many
      implementations will simply respond with the entire selected
      representation in a 200 (OK) response.  That is partly because
      most clients are prepared to receive a 200 (OK) to complete the
      task (albeit less efficiently) and partly because clients might
      not stop making an invalid partial request until they have
      received a complete representation.  Thus, clients cannot depend
      on receiving a 416 (Range Not Satisfiable) response even when it
      is most appropriate.