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
http_rewrite using HTML parser
[metaproxy-moved-to-github.git]
/
src
/
html_parser.cpp
diff --git
a/src/html_parser.cpp
b/src/html_parser.cpp
index
8d91a2c
..
49ef670
100644
(file)
--- a/
src/html_parser.cpp
+++ b/
src/html_parser.cpp
@@
-130,7
+130,7
@@
static int tagAttrs (mp::HTMLParserEvent & event,
const char *attr_value;
int val_len;
i = skipSpace (cp);
const char *attr_value;
int val_len;
i = skipSpace (cp);
- while (cp[i] && cp[i] != '>')
+ while (cp[i] && cp[i] != '>' && cp[i] != '/')
{
int nor = skipAttribute (cp+i, attr_name, &attr_value, &val_len);
i += nor;
{
int nor = skipAttribute (cp+i, attr_name, &attr_value, &val_len);
i += nor;
@@
-176,11
+176,16
@@
static int tagStart (mp::HTMLParserEvent & event,
static int tagEnd (mp::HTMLParserEvent & event, const char *tagName, const char *cp)
{
int i = 0;
static int tagEnd (mp::HTMLParserEvent & event, const char *tagName, const char *cp)
{
int i = 0;
+ int close_it = 0;
while (cp[i] && cp[i] != '>')
while (cp[i] && cp[i] != '>')
+ {
+ if (cp[i] == '/')
+ close_it = 1;
i++;
i++;
+ }
if (cp[i] == '>')
{
if (cp[i] == '>')
{
- event.anyTagEnd(tagName);
+ event.anyTagEnd(tagName, close_it);
i++;
}
return i;
i++;
}
return i;