I tried to send a request within a Greasemonkey script, using the Range-header.
The requested site is kind of long and I know which parts I actually need, so I thought, instead of requesting the whole site to download I could just request the necessary 500 bytes to speed things up.
However, Range: bytes=0-500 always gives me the full website. I also tried Content-Range: bytes=0-500, which doesn’t work, and Content-Length:500 which isn’t allowed to set any more due to security-problems.
So, does anybody know, why it is like this?
I’m using Greasemonkey scripts:
GM_xmlhttpRequest({
method: 'GET',
url: "http://colonel-strawberry.deviantart.com/",
headers: {"Range": "bytes=0-500"},
onload: function (responseDetails) {
console.log(responseDetails);
},
onerror: function(responseDetails) {
console.log("err:"+responseDetails);
}
});
With response-header:
Date: Mon, 05 Nov 2012 17:11:42 GMT
Content-Encoding: gzip
Transfer-Encoding: chunked
P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR CURa OUR STP"
Connection: Keep-Alive
Server: Apache
Vary: Accept-Encoding
Content-Type: text/html
Cache-Control: private
Keep-Alive: timeout=45
The host
colonel-strawberry.deviantart.comdoes not appear to support requests for byte ranges.You would need to be requesting the data from a server that does support them.
(I tested by comparing
curl -H "Range: bytes=50-60" $foowhere$foowas firsthttp://colonel-strawberry.deviantart.comand then where it was a URI on a server I do control).Note the HTTP specification: