206 Partial Content, mod_perl, strange errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Group

I'm trying to write a small perl script that supports Range requests
for partial file downloads using apache2.
If I INCORRECTLY leave off the 206 Partial Content header, I get back
what looks like a correct response (albeit with the wrong status code,
200 inserted for me). I get the correct data, and the content-range
and content-length data is correct. I'm using wfetch to test this, the
output log is in OUTPUT A below.

If I send a 206 Partial Content header (using cgi.pm) , it all seems
to go wrong :( See OUTPUT B below

What seems to be happening is that the 206 response is being
overridden to tell me about the error. The message about additional
content is also due to the error html as best I can tell. There is
sadly nothing at all in the error logs that are helping me locate the
problem.

I can't figure out where the problem is, is it my server config, is it
the mod_perl config, or am I sending out duff headers :(

System is ubuntu 8.04 / mod_perl2 /

The server is configured with;

PerlHandler ModPerl::Registry

The script itself outputs the headers like this;

print $cgi->header(     -status=>"206 Partial Content",
                                -expires=>"-1d",
                                -nph=>0,
                                -Content_Range=> $outputrange,
                                -Content_Length=>$outputrangelength,
                                -Content_Type=>$mime);

Could some kind soul point me in the direction of what I'm doing
wrong. We are writing this for our own client, so I could live with
the 200 OK option and run with it, but I'd prefer to try to do it
properly so in the future we could add in other clients. I've been
pulling my hair out for the last couple of hours googling and trying
various things out, but would appreciate some help from an apache
expert who also might use mod_perl.

Thanks!

Roger

--------------------------------------------------------------

OUTPUT A (OK but out of spec)

GET /cacheable/proxy.cgi?s=beam&o=txt&a=test&cache=101233r3r HTTP/1.1\r\n
Range: bytes=50-100\r\n
Host: www.xxxxxx.com\r\n
Accept: */*\r\n
\r\n
RESPONSE: **************\n
HTTP/1.1 200 OK\r\n
Date: Thu, 10 Dec 2009 17:53:47 GMT\r\n
Server: Apache\r\n
Expires: Wed, 09 Dec 2009 17:53:47 GMT\r\n
Content-length: 51\r\n
Content-range: bytes 50-100/20047\r\n
Content-Type: text/plain; charset=ISO-8859-1\r\n
\r\n
 elit. Sed ac augue neque, at tincidunt odio. Cras
finished.

--------------------------------------------------------------

OUTPUT B (try to send correct header)

GET /cacheable/proxy.cgi?s=beam&o=txt&a=test&cache=101233r3r HTTP/1.1\r\n
Range: bytes=50-100\r\n
Host: www.xxxxxxx.com\r\n
Accept: */*\r\n
\r\n
RESPONSE: **************\n
Extra data detected on socket (server sent more data in previous
response than client expected!!!)
HTTP/1.1 200 OK\r\n
Date: Thu, 10 Dec 2009 17:58:16 GMT\r\n
Server: Apache\r\n
Expires: Wed, 09 Dec 2009 17:58:16 GMT\r\n
Content-length: 51\r\n
Content-range: bytes 50-100/20047\r\n
Content-Type: text/plain; charset=ISO-8859-1\r\n
\r\n
 elit. Sed ac augue neque, at tincidunt odio. Cras <!DOCTYPE HTML
PUBLIC "-//IETF//DTD HTML 2.0//EN">\n
<html><head>\n
<title>200 OK</title>\n
</head><body>\n
<h1>OK</h1>\n
<p>The server encountered an internal error or\n
misconfiguration and was unable to complete\n
your request.</p>\n
<p>Please contact the server administrator,\n
 xxxxx and inform them of the time the error occurred,\n
and anything you might have done that may have\n
caused the error.</p>\n
<p>More information about this error may be available\n
in the server error log.</p>\n
<hr>\n
<address>Apache Server at www.xxxxxxxxxxxx.com Port 80</address>\n
</body></html>\n

END OF MESSAGE

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux