我如何启用字节范围请求? 当在iTunes上播放pod时,会显示一条错误消息:“您的Feed存在问题,您的节目托pipe在不支持字节范围请求的服务器上,启用字节范围请求并再次尝试提交。
请给我一个方法来启用字节范围请求
Apache为静态内容处理它。 如果内容是由PHP生成的,那么你需要相应地修改你的PHP代码。
假设http_send_file ()和http_send_data ()函数处理范围请求 – 但我不确定实际上是什么意思 – 需要一些实验。
Apache支持开箱即用的Byte-Range请求 – 假设它没有被明确禁用来解决这个DoS漏洞( http://httpd.apache.org/security/CVE-2011-3192 )。
你可以testing一些像下面这样简单的东西(在PHP中):
<?php $range = '60-120'; $host = "my.domain.name"; $socket = fsockopen($host,80); $packet = "GET /path/to/static/file.xml HTTP/1.1\r\nHost: $host\r\nRange:bytes=$range\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n"; fwrite($socket,$packet); echo fread($socket,2048);
运行上面,应该导致类似于以下内容:
HTTP/1.1 206 Partial Content Date: Tue, 10 Jul 2012 11:17:55 GMT Server: Apache Last-Modified: Tue, 10 Jul 2012 10:12:23 GMT Accept-Ranges: bytes Content-Length: 61 Content-Range: bytes 60-120/6433 Connection: close Content-Type: text/xml tp://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"> <ch
如果上述操作不起作用,那么很可能是有人closures了Range标头 – 请参阅上面的URL,以获取有关在.htaccess文件或全局Apacheconfiguration中查找内容的build议。