• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 11496
  • Last Modified:

Apache 2.0.54, Enabling Chunk transfer Encoding

  I have Apache 2.0.54 installed in a Windows 2000 server environment.
I want to know wether it has chunked trasfer encoding enabled.If not ,how can I enable it?
I tried looking through the docs, but no avail.
I have PHP installed too.
  • 7
  • 6
1 Solution
According to apache documentation if you use
 KeepAlive on
directive then
"If the client requests it, chunked encoding will be used in order to send content of unknown length over persistent connections."
blinker82Author Commented:
yes it is ON
But does it enable Apache Server to accept the Chunked data through say post.
I cannot turn off the chunked encoding at the client and hence have to make sure that Apache Server has the capability to accept chunked transfer encoding and currently it does not ( Atleast the one  I have installed)
It doesn't matter which method is used GET or POST. if chunked
it is possible that there is a config line in httpd.conf that disables chunked encoding for some browsers.
check for example for following line
BrowserMatch "MSIE 4\.0b2;" downgrade-1.0 force-response-1.0
(check for other force-response-1.0 words too)

and try to comment them

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

blinker82Author Commented:
ok ......so  I will reframe my question,
I want to what versions of Apache Server would support accepting chunk trasnfer encoded data.
I am Posting from Cisco Voice Gateway AS 5300 .Using VXML .I have no choice but to post using Chunk Transfer Encoding(default)
Now when i am posting, I get a content length required error from Apache, which I assume occurs because of the chunked transfer.
I am
What I want to know
1.)I am right about the reason why I get the content length required error?
2.)I can post alright from a form which does not use chunked transfer,but  how can i test sending data using chunked transfer from a normal HTML or PHP form   to a PHP script residing on the Apache Server?
3.)Does Apache Server support chunk trasnfer Encoding? What versions do that? I read somewhere that it has been turned of due to some security vulnerablitiy due to Chunk tranfer.Is there a Module ,which can enable that?
I am lost.

1) yo get it because chunked encoding is disabled
2) by defalt if you use http/1.1 client (eg. FireFox) then it will use chuncked transfer encoding. You can see it by some monitoring tools (like ethereal) in response. Transfer-Encoding: chunked header will appear on it. I tested it with www.kcn.ru and it was chucnked response.
3) Apache 1.3 through 1.3.24, and Apache 2.0 through 2.0.36, allows remote attackers to cause a denial of service and possibly execute arbitrary code via a chunk-encoded HTTP request that causes Apache to use an incorrect size.
If you will find version prior that versions then chuncked encoding should be enabled by default.
in CHANGES file of httpd source it is mentioned:
"Correctly return 413 when an invalid chunk size is given on
     input.  Also modify ap_discard_request_body to not do anything
     on sub-requests or when the connection will be dropped.
     [Justin Erenkrantz]"

It menas then you provide request without Contetn-Length header then you got content-length required error response.
blinker82Author Commented:
ok this is my form :-
header('Content-Transfer-Encoding: Chunked');
<form enctype="multipart/form-data" action="http://XXX/xml/loadsound.php"  method="POST">
    Send this file: <input name="myrec" type="file"  />
    <input type="submit" value="Send File" />

 I submit this form using FireFox browser. I sniffed the packets using ethereal. It does not say that the transfer encoding is chunked .There is no header called tranfer-encoding.
But when I sniffed packets coming from The Cisco Gateway.It was chunked.
What changes can I make to the form above,say if i embed php tags............to make the tranfer chunked?
I tried to send simple form with POST (on same www.kcn.ru server which supports chunked encoding ) and I don't need to provide any specific headers. Server self should decide will it send chunked or not based on browser header Accept-Encoding:
I provide you  request/response headers of my test session:

POST /tatweb/search.php HTTP/1.1
Host: www.kcn.ru
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3 (ax)
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: ru,en-us;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.kcn.ru/tatweb/search.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 48



HTTP/1.1 200 OK
Date: Thu, 12 May 2005 07:16:55 GMT
Server: Apache-AdvancedExtranetServer/1.3.27 (%{distribution}/8mdk) rus/PL30.17 PHP/4.3.1
X-Powered-By: PHP/4.3.1
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=windows-1251
Vary: accept-charset
blinker82Author Commented:
oh........ok...........actually I got the same response.........chunked
One more thing, I am using content-type: Mulitpart/form-data as I am posting a sound file.
It is working fine with when I post from the browser ..........it is the CISCO Voice Gateway i am posting from  ,when it says it does not have content length and just exits after that.
   I saw that from the browser also it does not get the content length ,but it accepts the post and even saves the file.
but when I send from the Voice Gateway.........it throws the HTTP 401.
any suggestions?
HTTP 401 means Authentication failure.
Is your URL protected by username/password ??
blinker82Author Commented:
actually the erro was 411 and not 401.......I am sorry.
And I also solved the problem. I will post the solution in a day or 2.
Thanks ramazanyich anyways
blinker82Author Commented:
actually I made the following change in the PHP source code.
In file sapi/apache/php_mod4.c

if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
if ((retval = setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) {

and recompiled the code.
voila it worked !!!
Actually the CISCO manual does give this info...........
Thanks  ramazanyich for ur help ............i ll give u the points nonetheless........
But this is the CORRECT ANSWER
blinker82Author Commented:
oops I want to change the grade from B to A.How to do that?

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now