diff src/scanner.cpp @ 52:a84752107aca

host names cannot have consecutive periods.
author carl
date Thu, 15 Jul 2004 23:01:41 -0700
parents 05957b18b2e6
children a39c813e8f7b
line wrap: on
line diff
--- a/src/scanner.cpp	Tue Jul 13 08:54:03 2004 -0700
+++ b/src/scanner.cpp	Thu Jul 15 23:01:41 2004 -0700
@@ -957,8 +957,9 @@
                     // not an email address or message id
                     char *p1 = strchr((const char *)pending, '.');
                     char *p2 = strrchr((const char *)pending, '.');
-                    if (p1 && (p1 != p2)) {
-                        // have two periods, so three components
+                    char *p3 = strstr((const char *)pending, "..");
+                    if (p1 && (p1 != p2) & !p3) {
+                        // have two periods, so at least three components, and no empty components
                         for (int i=0; i<count; i++) pending[i] = tolower(pending[i]);
                         // is last component a tld?
                         string_set::iterator i = memory->tlds->find(p2+1);
@@ -1012,6 +1013,7 @@
                     char *p = strrchr((const char *)pending, '/');
                     if (p              &&                                       // have a leading /
                         strchr(p, '.') &&                                       // require at least one . in a dns name
+                        !strstr(p, "..") &&                                     // no empty components in the dns name
                         (strncasecmp((const char *)pending, "http", 4) == 0)) { // must start with protocol
                         // we seem to have a host name
                         p++;                    // skip the last /