6

I am verifying if my application handles file content delivered through chunked-encoding mode. I am not sure what change to make to the httpd.conf file to force chunked encoding through Apache. Is it even possible to do this with Apache server, if not what would be an easier solution? I am using Apache 2.4.2 and HTTP 1.1.

By default, keep-alive is On in Apache and I do not see the data as chunked when testing with wireshark.

EDIT: Added more info:

sgowd
  • 946
  • 3
  • 10
  • 27
  • Do you have any more context? – Tom Apr 29 '13 at 18:30
  • same problem. I'd like to get Apache to server some files in chunked encoding mode, so that I can verify the client works correctly. Or is there perhaps a server that server variously sized files in chunks? – Henry Story Jul 22 '13 at 08:55

3 Answers3

1

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
< 
Iker Jimenez
  • 7,105
  • 9
  • 49
  • 46
0

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 OK
Cache-Control: private,Public
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 22 Jul 2013 09:41:04 GMT

7b
<!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">
....
Henry Story
  • 2,116
  • 1
  • 17
  • 28
0

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>
...
...
...
NPE
  • 432
  • 5
  • 13