A few things to consider:
-
The HTTP::respond command automatically calculates and inserts a Content-Length header, which is not allowed when a Transfer-Encoding header exists. To get around that, use the TCP::respond command instead and write the entire payload manually.
-
You may also notice in the Apache response that the first line of the content is either a number or a hexadecimal value. This "prefix" is generally required for Transfer-Encoding. It tells the browser how much data to expect in each response.
So given the above, you could do something like this:
when HTTP_REQUEST {
TCP::respond "HTTP/1.1 200 OK\r\nContent-Type: text/xml;charset=utf-8\r\nTransfer-Encoding: chunked\r\n\r\n129\r\nGambardella, MatthewXML Developer's GuideComputer44.952000-10-01An in-depth look at creating applications with XML.\r\n0\r\n\r\n"
}
Notice the 129 as the start of the payload. This is the hexadecimal encoding of the content length (in this case 297 without the escape "\" characters). If this is the end of the data, then it's followed by a 0 chunk (\r\n0\r\n\r\n).
http://en.wikipedia.org/wiki/Chunked_transfer_encoding