Range-headerを使用して、Greasemonkeyスクリプト内でリクエストを送信しようとしました。リクエストされたサイトはかなり長く、実際に必要なパーツがわかっているので、サイト全体のダウンロードをリクエストする代わりに、必要な500バイトをリクエストするだけで処理を高速化できると思いました。
しかし、Range: bytes=0-500
常に私に完全なウェブサイトを与えます。私も試しContent-Range: bytes=0-500
ましたが、これは機能せず、Content-Length:500
セキュリティ上の問題のためにこれ以上設定できません。
それで、なぜそれがこのようであるか、誰かが知っていますか?私はGreasemonkeyスクリプトを使用しています:
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);
}
});
応答ヘッダー付き:
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