support CDATA in xml parser

This commit is contained in:
Arvid Norberg 2010-12-29 01:59:41 +00:00
parent fbbdc46e19
commit ea04fbb22c
2 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,4 @@
* supporr CDATA tags in xml parser
* use a python python dictionary for settings instead of session_settings object (in python bindings)
* optimized metadata transfer (magnet link) startup time (shaved off about 1 second)
* optimized swarm startup time (shaved off about 1 second)

View File

@ -80,7 +80,30 @@ namespace libtorrent
if (p == end) break;
// skip '<'
++p;
++p;
if (p != end && p+8 < end && string_begins_no_case("![CDATA[", p))
{
// CDATA. match '![CDATA['
p += 8;
start = p;
while (p != end && !string_begins_no_case("]]>", p-2)) ++p;
// parse error
if (p == end)
{
token = xml_parse_error;
start = "unexpected end of file";
callback(token, start, val_start);
break;
}
token = xml_string;
char tmp = p[-2];
p[-2] = 0;
callback(token, start, val_start);
p[-2] = tmp;
continue;
}
// parse the name of the tag.
for (start = p; p != end && *p != '>' && !isspace(*p); ++p);
@ -202,7 +225,6 @@ namespace libtorrent
*i = save;
}
}
}
}