Mercurial > dnsbl
comparison src/scanner.cpp @ 9:8c65411cd7ab
integration work on url scanner
author | carl |
---|---|
date | Thu, 22 Apr 2004 14:00:02 -0700 |
parents | dbe18921f741 |
children | 2c206836b4cc |
comparison
equal
deleted
inserted
replaced
8:dbe18921f741 | 9:8c65411cd7ab |
---|---|
841 | 841 |
842 void fsa::push(u_char *buf, int len) { | 842 void fsa::push(u_char *buf, int len) { |
843 for (int i=0; i<len; i++) { | 843 for (int i=0; i<len; i++) { |
844 u_char c = buf[i]; | 844 u_char c = buf[i]; |
845 // guard against buffer overflow | 845 // guard against buffer overflow |
846 if (count == PENDING_LIMIT-1) { | 846 if (count == (PENDING_LIMIT-1)) { |
847 if (next) next->push(pending, count); | 847 if (next) next->push(pending, count); |
848 count = 0; | 848 count = 0; |
849 st = init; | 849 st = init; |
850 } | 850 } |
851 pending[count++] = c; | 851 pending[count++] = c; |
860 st = u_init; | 860 st = u_init; |
861 } | 861 } |
862 } break; | 862 } break; |
863 | 863 |
864 case u_reco: { | 864 case u_reco: { |
865 pending[count-1] = 0; | 865 if (count > 12) { |
866 if (strncasecmp((const char *)pending, "http://", 7) == 0) { | 866 pending[count-1] = 0; |
867 urls->insert(strdup((const char *)pending+7)); | 867 if (strncasecmp((const char *)pending, "http://", 7) == 0) { |
868 urls->insert(strdup((const char *)pending+7)); | |
869 } | |
868 } | 870 } |
869 } // fall thru | 871 } // fall thru |
870 | 872 |
871 case u_init: { | 873 case u_init: { |
872 count = 0; // discard all characters | 874 count = 0; // discard all characters |