comparison src/scanner.cpp @ 143:ecb40aa3eaa5 stable-5-23

require two periods for ip addresses
author carl
date Tue, 10 Oct 2006 19:12:16 -0700
parents df355d117199
children 812c80305f26
comparison
equal deleted inserted replaced
142:b82e00146672 143:ecb40aa3eaa5
1 /* 1 /*
2 2
3 Copyright (c) 2004 Carl Byington - 510 Software Group, released under 3 Copyright (c) 2006 Carl Byington - 510 Software Group, released under
4 the GPL version 2 or any later version at your choice available at 4 the GPL version 2 or any later version at your choice available at
5 http://www.fsf.org/licenses/gpl.txt 5 http://www.fsf.org/licenses/gpl.txt
6 6
7 */ 7 */
8 8
1213 char *p3 = strstr((const char *)pending, ".."); 1213 char *p3 = strstr((const char *)pending, "..");
1214 if (p1 && (p1 != (char*)pending) & !p3) { 1214 if (p1 && (p1 != (char*)pending) & !p3) {
1215 // have a period, so at least two components, and no empty components 1215 // have a period, so at least two components, and no empty components
1216 in_addr ip; 1216 in_addr ip;
1217 if (inet_aton((const char*)pending, &ip)) 1217 if (inet_aton((const char*)pending, &ip))
1218 memory->new_url((char*)pending); 1218 // have an ip address if at least two periods
1219 if (p1 != p2) memory->new_url((char*)pending);
1219 else { 1220 else {
1220 for (int i=0; i<count; i++) pending[i] = tolower(pending[i]); 1221 for (int i=0; i<count; i++) pending[i] = tolower(pending[i]);
1221 // is last component a tld? 1222 // is last component a tld?
1222 string_set::iterator i = memory->get_tlds()->find(p2+1); 1223 string_set::iterator i = memory->get_tlds()->find(p2+1);
1223 if (i != memory->get_tlds()->end()) memory->new_url((char*)pending); 1224 if (i != memory->get_tlds()->end()) memory->new_url((char*)pending);