Skip to main content
Topic: site slow (Read 9585 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: site slow

Reply #30

Just to add to the info.

  • In a default Alpine Linux install, nslookup existed but not the host command (until you instal bind-util)
  • In a default Ubuntu install, just the oposite, host existed but not nslookup (until you install  bind9-dnsutils)
  • The output of nslookup on *nix is different than windows, so the current regex will not work on both systems
  • At some point nslookup was marked for depreciation and then that was reverted (we are talking 15+ years ago) which may explain why it was used on windows only.  But by default it is in windows, but not all *nix installs.
  • I don't have an explanation for mt_rand() being used.  Perhaps someone was concerned about the timeout being to short (some DNS responses can take more than a second) so if you did not have the host name in cache you had a 50/50 chance of running host w/timeout and then possibly gethostbyaddr() with no timeout or just gethostbyaddr()
Quote from: tino –
Code: [Select]
function gethostbyaddr_timeout($ip, $dns, $timeout = 1000)
That is an interesting approach .. looks like it would have to be improved to support ipv6 as well