Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sample http range request session

Is it possible to show me a sample http session with range requests. I mean what would be the request and response headers?

like image 259
chamal Avatar asked Nov 28 '11 09:11

chamal


People also ask

What is HTTP range request?

An HTTP range request asks the server to send only a portion of an HTTP message back to a client. Range requests are useful for clients like media players that support random access, data tools that know they need only part of a large file, and download managers that let the user pause and resume the download.

How do I send a partial HTTP request?

To initiate a partial range request, the client must initiate a request to the server and will potentially receive two headers: Accept-Ranges and Content-Length . If the server supports partial range requests, the value for Accept-Ranges will be bytes ; otherwise, the value will be none .

What is req headers range?

The Range HTTP request header indicates the part of a document that the server should return. Several parts can be requested with one Range header at once, and the server may send back these ranges in a multipart document. If the server sends back ranges, it uses the 206 Partial Content for the response.

What is byte range request?

What are byte-range requests? # Byte-range requests occur when a client asks the server for only a portion of the requested file. The purpose of this is essentially to conserve bandwidth usage by avoiding the need to download a complete file when all that is required is a small section.


1 Answers

The following exchange is between Chrome and a static web server, retrieving an MP4 video.

Initial request - for the video. Note the Accept-Ranges response header to indicate the server has range header support:

GET /BigBuckBunny_320x180.mp4         Cache-Control: max-age=0         Connection: keep-alive         Accept-Language: en-GB,en-US,en         Host: localhost:8080         Range:         Accept: text/html,application/xhtml+xml,application/xml,*/*         User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...         Accept-Encoding: gzip,deflate,sdch         Accept-Charset: ISO-8859-1,utf-8,* 200 OK         Content-Type: video/mp4         Connection: keep-alive         Last-Modified: Wed,14 Dec 2011 15:50:59 GMT         ETag: A023EF02BD589BC472A2D6774EAE3C58         Transfer-Encoding:         Content-Length: 64657027         Accept-Ranges: bytes         Server: Brisket/1.0.1         Date: Wed,14 Dec 2011 16:11:24 GMT 

Range header in previous response detected - subsequent request with open-ended range to confirm support. Response returns a 206 status and Content-Range header to indicate the bytes present in the response body:

GET /BigBuckBunny_320x180.mp4         Connection: keep-alive         Accept-Language: en-GB,en-US,en         Host: localhost:8080         Range: bytes=0-         Accept: */*         User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...         Referer: http://localhost:8080/BigBuckBunny_320x180.mp4         Accept-Encoding: identity         Accept-Charset: ISO-8859-1,utf-8,* 206 Partial Content         Content-Type: video/mp4         Connection: keep-alive         Last-Modified: Wed,14 Dec 2011 15:50:59 GMT         ETag: A023EF02BD589BC472A2D6774EAE3C58         Transfer-Encoding:         Content-Length: 64657027         Accept-Ranges: bytes         Server: Brisket/1.0.1         Date: Wed,14 Dec 2011 16:11:25 GMT         Content-Range: bytes 0-64657026/64657027 

Subsequent range request to capture the end of the file (probably to capture trailing metadata):

GET /BigBuckBunny_320x180.mp4         Connection: keep-alive         Accept-Language: en-GB,en-US,en         Host: localhost:8080         Range: bytes=64312833-64657026         Accept: */*         If-Range: A023EF02BD589BC472A2D6774EAE3C58         User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...         Referer: http://localhost:8080/BigBuckBunny_320x180.mp4         Accept-Encoding: identity         Accept-Charset: ISO-8859-1,utf-8,* 206 Partial Content         Content-Type: video/mp4         Connection: keep-alive         Last-Modified: Wed,14 Dec 2011 15:50:59 GMT         ETag: A023EF02BD589BC472A2D6774EAE3C58         Transfer-Encoding:         Content-Length: 344194         Accept-Ranges: bytes         Server: Brisket/1.0.1         Date: Wed,14 Dec 2011 16:11:25 GMT         Content-Range: bytes 64312833-64657026/64657027 

User clicks in the video progress bar beyond the downloaded range - a range request is issued to begin playing from the selected position:

GET /BigBuckBunny_320x180.mp4         Connection: keep-alive         Accept-Language: en-GB,en-US,en         Host: localhost:8080         Range: bytes=1073152-64313343         Accept: */*         If-Range: A023EF02BD589BC472A2D6774EAE3C58         User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 ...         Referer: http://localhost:8080/BigBuckBunny_320x180.mp4         Accept-Encoding: identity         Accept-Charset: ISO-8859-1,utf-8,* 206 Partial Content         Content-Type: video/mp4         Connection: keep-alive         Last-Modified: Wed,14 Dec 2011 15:50:59 GMT         ETag: A023EF02BD589BC472A2D6774EAE3C58         Transfer-Encoding:         Content-Length: 63240192         Accept-Ranges: bytes         Server: Brisket/1.0.1         Date: Wed,14 Dec 2011 16:11:25 GMT         Content-Range: bytes 1073152-64313343/64657027 
like image 111
johnstok Avatar answered Oct 09 '22 09:10

johnstok