示例http范围请求会话

编程入门 行业动态 更新时间:2024-10-18 08:29:57
本文介绍了示例http范围请求会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以向我展示带范围请求的示例http会话。 我的意思是请求和响应标头是什么?

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

推荐答案

以下交换是在Chrome和静态网络之间进行的服务器,检索MP4视频。

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

初始请求 - 视频。请注意 Accept-Ranges 响应标头,以指示服务器具有范围标头支持:

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

范围hea检测到之前的响应中的后续请求 - 具有开放式范围的后续请求以确认支持。响应返回206状态和 Content-Range 标头,以指示响应正文中存在的字节:

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: 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: 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: 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

更多推荐

示例http范围请求会话

本文发布于:2023-11-28 14:17:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642752.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:示例   http

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!