문제

The 206 status code (w3.org) indicates a partial result in response to a request with a Range header.

So "clearly" if the requested document is e.g. 1024 bytes long, and the Range header is bytes=0-512 then a status code of 206 Partial Content should be returned. (Assuming that the server is able to return the content)

BUT what if the Range is bytes=0-2000?
Should 200 OK or 206 Partial Content be returned?
It seems to me that this isn't clearly defined in the specification -- or maybe I'm not reading the right place?

Why do I care? I ask because the Varnish Cache seems to always return 206 Partial Content, whereas the Facebook Open Graph debugger seems to expect 200 OK. [1] [2]

Example: GET request to Varnish
(I receive the full document, and yet 206 Partial Content is returned)

> curl --dump-header - -H 'Range: bytes=0-7000' https://www.varnish-cache.org/sites/all/themes/varnish_d7/logo.png
HTTP/1.1 206 Partial Content
Server: nginx/1.1.19
Date: Mon, 14 Apr 2014 22:43:31 GMT
Content-Type: image/png
Content-Length: 2884
Connection: keep-alive
Last-Modified: Thu, 15 Dec 2011 12:30:46 GMT
Accept-Ranges: bytes
X-Varnish: 1979866667
Age: 0
Via: 1.1 varnish
Content-Range: bytes 0-2883/2884

Further w3 reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35

도움이 되었습니까?

해결책

It doesn't matter. Both replies are valid.

(also note that the current specification is now http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p5-range-26.html, to be published as RFC soon)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top