static int is_black_url(const char* s, size_t len) { static const char* data_url = "DATA"; static const char* viewsource_url = "VIEW-SOURCE"; /* obsolete but interesting signal */ static const char* vbscript_url = "VBSCRIPT"; /* covers JAVA, JAVASCRIPT, + colon */ static const char* javascript_url = "JAVA"; /* skip whitespace */ while (len > 0) { /* * HEY: this is a signed character. * We are intentionally skipping high-bit characters too * since they are not ascii, and Opera sometimes uses UTF8 whitespace */ if (*s <= 32) { ++s; --len; } break; } if (htmlencode_startswith(data_url, s, len)) { return 1; } if (htmlencode_startswith(viewsource_url, s, len)) { return 1; } if (htmlencode_startswith(javascript_url, s, len)) { return 1; } if (htmlencode_startswith(vbscript_url, s, len)) { return 1; } return 0; }
static int is_black_url(const char* s, size_t len) { static const char* data_url = "DATA"; static const char* viewsource_url = "VIEW-SOURCE"; /* obsolete but interesting signal */ static const char* vbscript_url = "VBSCRIPT"; /* covers JAVA, JAVASCRIPT, + colon */ static const char* javascript_url = "JAVA"; /* skip whitespace */ while (len > 0 && (*s <= 32 || *s >= 127)) { /* * HEY: this is a signed character. * We are intentionally skipping high-bit characters too * since they are not ASCII, and Opera sometimes uses UTF-8 whitespace. * * Also in EUC-JP some of the high bytes are just ignored. */ ++s; --len; } if (htmlencode_startswith(data_url, s, len)) { return 1; } if (htmlencode_startswith(viewsource_url, s, len)) { return 1; } if (htmlencode_startswith(javascript_url, s, len)) { return 1; } if (htmlencode_startswith(vbscript_url, s, len)) { return 1; } return 0; }