projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix ref to freed memory in log filter 1line - MP-556
[metaproxy-moved-to-github.git]
/
src
/
html_parser.cpp
diff --git
a/src/html_parser.cpp
b/src/html_parser.cpp
index
abbdeba
..
95db7c7
100644
(file)
--- a/
src/html_parser.cpp
+++ b/
src/html_parser.cpp
@@
-1,5
+1,5
@@
/* This file is part of Metaproxy.
/* This file is part of Metaproxy.
- Copyright (C) 2005-2013 Index Data
+ Copyright (C) Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-166,8
+166,12
@@
int mp::HTMLParser::Rep::tagAttrs(HTMLParserEvent &event,
x[0] = tr;
x[1] = 0;
if (m_verbose)
x[0] = tr;
x[1] = 0;
if (m_verbose)
- printf ("------ attr %.*s=%.*s\n", attr_len, attr_name,
- val_len, value);
+ {
+ printf("------ attr %.*s", attr_len, attr_name);
+ if (value)
+ printf("=%.*s", val_len, value);
+ printf("\n");
+ }
event.attribute(name, len, attr_name, attr_len, value, val_len, x);
}
return i;
event.attribute(name, len, attr_name, attr_len, value, val_len, x);
}
return i;
@@
-195,7
+199,7
@@
int mp::HTMLParser::Rep::tagEnd(HTMLParserEvent &event,
{
if (m_verbose)
printf("------ any tag %s %.*s\n",
{
if (m_verbose)
printf("------ any tag %s %.*s\n",
- close_it ? " close" : "end", tag_len, tag);
+ close_it ? "close" : "end", tag_len, tag);
event.anyTagEnd(tag, tag_len, close_it);
i++;
}
event.anyTagEnd(tag, tag_len, close_it);
i++;
}
@@
-264,20
+268,21
@@
void mp::HTMLParser::Rep::parse_str(HTMLParserEvent &event, const char *cp)
else if (*cp == '/' && isAlpha(cp[1]))
{
int i;
else if (*cp == '/' && isAlpha(cp[1]))
{
int i;
- tagText(event, text_start, cp - 1);
-
+
i = skipName(++cp);
if (!nest)
{
if (i == 6 && !yaz_strncasecmp(cp, "script", i))
i = skipName(++cp);
if (!nest)
{
if (i == 6 && !yaz_strncasecmp(cp, "script", i))
- nest = true;
- else
{
{
- text_start = cp - 1; // points to '/'
- continue;
+ int ws = skipSpace(cp + 6);
+ if (cp[ws + 6] == '>')
+ nest = true; /* really terminated */
}
}
+ if (!nest)
+ continue;
}
}
+ tagText(event, text_start, cp - 2);
event.closeTag(cp, i);
if (m_verbose)
printf("------ tag close %.*s\n", i, cp);
event.closeTag(cp, i);
if (m_verbose)
printf("------ tag close %.*s\n", i, cp);