changeset 130:e316f6fd9c39

uribl lookups fully qualified; allow two component host names
author carl
date Tue, 01 Aug 2006 10:44:55 -0700
parents c5cd1261394d
children df355d117199
files src/scanner.cpp
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/scanner.cpp	Tue Jun 06 08:45:07 2006 -0700
+++ b/src/scanner.cpp	Tue Aug 01 10:44:55 2006 -0700
@@ -1203,15 +1203,16 @@
 }
 
 void fsa::validhost () {
-	// remove trailing dot
-	if (pending[count-1]== '.') pending[--count] = '\0';
+	// remove trailing periods
+	while (count && (pending[count-1]== '.')) pending[--count] = '\0';
+	if (!count) return; // empty string
 	if (!strchr((const char *)pending, '@')) {
 		// not an email address or message id
 		char *p1 = strchr((const char *)pending, '.');
 		char *p2 = strrchr((const char *)pending, '.');
 		char *p3 = strstr((const char *)pending, "..");
-		if (p1 && (p1 != p2) & !p3) {
-			// have two periods, so at least three components, and no empty components
+		if (p1 && (p1 != pending) & !p3) {
+			// have a period, so at least two components, and no empty components
 			in_addr ip;
 			if (inet_aton((const char*)pending, &ip))
 				memory->new_url((char*)pending);