[PHP-DEV] Bug #490: Win32 sendmail is very slow when specifying SMTP host as IP address From: tma <email protected>
Date: 06/29/98

From: tma <email protected>
Operating system: WinNT 4.0
PHP version: 3.0 Final Release
PHP Bug Type: Performance problem
Bug description:
When specifying SMTP host as an IP address in the php3.ini file (e.g. SMTP=192.168.101.1),
the gethostbyname() call performed by sendmail.c times out, resulting in very poor performance.

A quick hack: If MailHost starts with a numeric character, do not perform the gethostbyname() call
(BTW: The results do not appear to be used anyway!)

--- c:/user/gh/php-3.0/win32/sendmail.c~ Mon Jun 29 12:02:00 1998
+++ c:/user/gh/php-3.0/win32/sendmail.c Mon Jun 29 12:03:22 1998
@@ -380,9 +380,12 @@
                 return (FAILED_TO_GET_HOSTNAME);
 
         // Resolve the servers IP
- GLOBAL(adr) = gethostbyname(GLOBAL(MailHost));
- if (!GLOBAL(adr))
- return (FAILED_TO_RESOLVE_HOST);
+ if (!isdigit(GLOBAL(MailHost)))
+ {
+ GLOBAL(adr) = gethostbyname(GLOBAL(MailHost)[0]);
+ if (!GLOBAL(adr))
+ return (FAILED_TO_RESOLVE_HOST);
+ }
 
         // Connect to server
         GLOBAL(sock_in).sin_family = AF_INET;