比如說從第1024字節開始下載,請求報文如下:
GET /image/index_r4_c1.jpg HTTP/1.1
Accept: */*
Referer: http://192.168.3.120:8080
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
Host: 192.168.3.120:8080
Range:bytes=1024-
Connection: Keep-Alive
如果要指定由1024-2046
Range:bytes=1024-2046
HTTP響應消息頭的Content-Range字段被設為如下的形式:
Content-Range: bytes 1024-2046/2047 //2047:文件總大小
另外要注意的是植樹問題:
Content-Range: bytes 0-127/128 //128:文件總大小
除了Content-Range外還有Accept-Ranges,如支援partial content的話
Accept-Ranges: bytes
如不支援則回應None
Accept-Ranges: none
沒有留言:
發佈留言