Home » Networking » Net_DNS » Bug #9268
send_tcp method doesn't receive all packets
Details
| Submitted | 2006-11-08 13:26 UTC |
|---|---|
| From | pieter at prezent dot nl |
| Assigned | fa |
| Status | Closed |
| Package | Net_DNS |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2006-11-08 13:26 UTC] pieter at prezent dot nl
Description:
------------
In the method send_tcp, two freads are used to read in the data. If the response of the DNS server is bigger than two packets (for example for zone transfers of large zones), not everything is read, which results in an error. This is because fread() stops reading when a new packet is received, see php manual.
This is a patch:
--- DNS/Resolver.php.orig 2006-11-08 14:01:13.000000000 +0100
+++ DNS/Resolver.php 2006-11-08 14:15:25.000000000 +0100
@@ -787,7 +787,10 @@
if (!$len) {
continue;
}
- $buf = fread($sock, $len);
+ $buf = '';
+ while (!feof($sock) && (strlen($buf) < $len) ) {
+ $buf .= fread($sock, $len-strlen($buf));
+ }
$actual = strlen($buf);
$this->answerfrom = $ns;
$this->answersize = $len;