How do I force apache to deliver a file in chunked encoded format
Only way I managed to do this was by enabling the deflate module.Then I configured my client to send "Accept-Encoding: gzip, deflate"
header and apache would compress and send the file back in chunked mode.I had to enable the file type in the module though.AddOutputFilterByType DEFLATE image/png
See example:
curl --raw -v --header "Accept-Encoding: gzip, deflate" http://localhost/image.png | more* Connected to localhost (127.0.0.1) port 80 (#0)> GET /image.png HTTP/1.1> User-Agent: curl/7.35.0> Host: localhost> Accept: */*> Accept-Encoding: gzip, deflate> < HTTP/1.1 200 OK< Date: Mon, 13 Apr 2015 10:08:45 GMT* Server Apache/2.4.7 (Ubuntu) is not blacklisted< Server: Apache/2.4.7 (Ubuntu)< Last-Modified: Mon, 13 Apr 2015 09:48:53 GMT< ETag: "3b5306-5139805976dae-gzip"< Accept-Ranges: bytes< Vary: Accept-Encoding< Content-Encoding: gzip< Transfer-Encoding: chunked< Content-Type: image/png<
This resource produces chunked results http://www.httpwatch.com/httpgallery/chunked/ which is very useful for testing clients. You can see this by running
$ curl --raw -i http://www.httpwatch.com/httpgallery/chunked/HTTP/1.1 200 OKCache-Control: private,PublicTransfer-Encoding: chunkedContent-Type: text/htmlServer: Microsoft-IIS/7.5X-AspNet-Version: 4.0.30319X-Powered-By: ASP.NETDate: Mon, 22 Jul 2013 09:41:04 GMT7b<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">2d<html xmlns="http://www.w3.org/1999/xhtml">....
I tried this way to get HTTP chunked encoded data in Ubuntu, it might help.
In apache server create a file index.php
in your directory where index page is there ( ex : /var/www/html/
) and paste below content (should have php installed):
<?php phpinfo(); ?>
Then try to curl the page as below :
root@ubuntu-16:~# curl -v http://10.11.0.230:2222/index.php* Trying 10.11.0.230...* Connected to 10.11.0.230 (10.11.0.230) port 2222 (#0)> GET /index.php HTTP/1.1> Host: 10.11.0.230:2222> User-Agent: curl/7.47.0> Accept: */*>< HTTP/1.1 200 OK< Date: Wed, 01 Jul 2020 07:51:24 GMT< Server: Apache/2.4.18 (Ubuntu)< Vary: Accept-Encoding< Transfer-Encoding: chunked< Content-Type: text/html; charset=UTF-8<<!DOCTYPE html><html><body>.........