I have a WebDAV propfind request sent using PHP. The HTTP request looks like this:
PROPFIND /path/to/whatever HTTP/1.1
User-Agent: My Client
Accept-Encoding: deflate
Depth: 1
Host: example.com
Content-Type: text/xml;charset=UTF-8
Authorization: Basic bLahDeBlah=
Content-Length: 82
Connection: close
<?xml version='1.0' encoding='utf-8'?><propfind xmlns='DAV:'><allprop/></propfind>
It works fine when the response XML is less than about 1.5 MB. When the response is bigger, the XML contains characters like \r\n2000\r\n
and occasionaly \r\n20a0\r\n
.
I am using this PHP code to retrieve the response:
<?php
$output = "";
while (!feof($this->socket)) {
$output .= fgets($this->socket, 1024);
}
I can get around this issue by stripping the unwanted characters from the response - but I'd like to prevent this. Any idea what could cause this?
Update: The response header contains Transfer-Encoding: chunked
. Our PHP build is Windows and I believe there is no DLL available to use http_chunked_decode()
.