return ret;
}
- else if (tag->id == Tag_HEAD) {
+ else if (tag->id == Tag_HEAD && (tag->flags & FL_IGNORE)) {
auto ret = tag->closing.end;
calculate_final_tag_offsets();
if (html_document_state == html_document_state::doctype) {
if (cur_tag->id == Tag_HEAD || (cur_tag->flags & CM_HEAD)) {
html_document_state = html_document_state::head;
+ cur_tag->flags |= FL_IGNORE;
}
else if (cur_tag->id != Tag_HTML) {
html_document_state = html_document_state::body;
{
using namespace std::string_literals;
const std::vector<std::pair<std::string, std::string>> cases{
+ {"<html><body><html><head>displayed</body></html></body></html>", "displayed"},
{"test", "test"},
{"test\0"s, "test\uFFFD"s},
{"test\0test"s, "test\uFFFDtest"s},
/* Head tag with some stuff */
{"<html><head><p>oh my god</head><body></body></html>", "oh my god\n"},
{"<html><head><title>oh my god</head><body></body></html>", ""},
+
};
rspamd_url_init(NULL);