text = g_byte_array_new();
text->data = (gchar *)test_text;
- text->len = sizeof (test_text);
+ text->len = strlen (test_text);
html = g_byte_array_new();
html->data = (gchar *)test_html;
- html->len = sizeof (test_html);
+ html->len = strlen (test_html);
bzero (&task, sizeof (task));
TAILQ_INIT (&task.urls);
unsigned int need_ssl:1;
};
-static const char *html_url = "((?:href\\s*=\\s*)|(?:archive\\s*=\\s*)|(?:code\\s*=\\s*)|(?:codebase\\s*=\\s*)|(?:src\\s*=\\s*)|(?:cite\\s*=\\s*)"
-"|(:?background\\s*=\\s*)|(?:pluginspage\\s*=\\s*)|(?:pluginurl\\s*=\\s*)|(?:action\\s*=\\s*)|(?:dynsrc\\s*=\\s*)|(?:longdesc\\s*=\\s*)|(?:lowsrc\\s*=\\s*)|(?:usemap\\s*=\\s*))"
-"\\\"?([^>\"<]+)\\\"?";
-static const char *text_url = "((?:mailto\\:|(?:news|(?:ht|f)tp(?:s?))\\://){1}[^ ]+)";
+static const char *html_url = "((?:href\\s*=\\s*)?([^>\"<]+))?";
+static const char *text_url = "(https?://[^ ]+)";
static short url_initialized = 0;
GRegex *text_re, *html_re;
else {
msg_debug ("url_parse_text: cannot find url pattern in given string");
}
- } while (rc > 0);
+ } while (rc);
}
}
if (rc) {
if (g_match_info_matches (info)) {
g_match_info_fetch_pos (info, 0, &start, &pos);
- url_str = g_match_info_fetch (info, 3);
+ url_str = g_match_info_fetch (info, 2);
msg_debug ("url_parse_html: extracted string with regexp: '%s'", url_str);
if (url_str != NULL) {
new = g_malloc (sizeof (struct uri));
else {
msg_debug ("url_parse_html: cannot find url pattern in given string");
}
- } while (rc > 0);
+ } while (rc);
}
}