You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Pravesh Rai <pr...@gmail.com> on 2011/06/09 11:53:09 UTC

[users@httpd] Getting Content-Range field in HTTP header

Hi All,

Can anyone please let me know, how to get this field in HTTP header ?

Thanks,
PK

Re: [users@httpd] Getting Content-Range field in HTTP header

Posted by Mark Montague <ma...@catseye.org>.
  On June 9, 2011 5:53 , Pravesh Rai <pr...@gmail.com>  wrote:
> Can anyone please let me know, how to get this field in HTTP header ?

First, the browser or other client needs to request a byte range 
response.  To do this, the client must use HTTP 1.1 with a Range header 
specifying the byte range it would like to receive from the server.

Next, the web server must be able to know the length of the response 
without having to buffer the entire response in memory before sending 
the response to the client.  Certain types of content -- for example, 
content generated by CGIs -- or certain output filters may not allow 
this.  I don't know which filters may cause problems, but if you see a 
"Transfer-Encoding: chunked" in your HTTP response headers, you may be 
experiencing this problem.  In this case, try disabling/removing various 
filters (mod_include, mod_deflate) until you find the source of the 
problem.  If your content is being generated by a CGI or other source of 
non-static content, see if having the CGI add a correct "Content-Length" 
response header helps.  I apologize that I cannot be more specific here; 
maybe someone else can supply a more accurate answer.

There are no configuration directives that control the Content-Range 
behavior that I am aware of.

Here is an example showing how Content-Range is used:

$ telnet httpd.apache.org 80
Trying 140.211.11.131...
Connected to httpd.apache.org.
Escape character is '^]'.
GET / HTTP/1.1
Host: httpd.apache.org
Range: bytes=0-300

HTTP/1.1 206 Partial Content
Date: Thu, 09 Jun 2011 10:11:43 GMT
Server: Apache/2.3.8 (Unix) mod_ssl/2.3.8 OpenSSL/1.0.0c
Last-Modified: Sun, 22 May 2011 17:04:34 GMT
ETag: "b96c29-247b-4a3e0595b4c80"
Accept-Ranges: bytes
Content-Length: 301
Vary: Accept-Encoding
Content-Range: bytes 0-300/9339
Content-Type: text/html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="author" content="Documentation Group" /><meta name="email" 
Connection closed by foreign host.
$


I hope this helps.

--
   Mark Montague
   mark@catseye.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org