From 7bde7f66284b47a75bbceadc360e7f03550ace21 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sat, 05 Jan 2008 19:39:07 +0000 Subject: discovery: stop parser with XML_StopParser() Signed-off-by: Michael Krelin --- (limited to 'lib') diff --git a/lib/discovery.cc b/lib/discovery.cc index 81727c0..8729cfb 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include "config.h" @@ -175,7 +176,11 @@ namespace opkele { if(skipping<0) return 0; /* TODO: limit total size */ size_t bytes = s*nm; - parse((const char *)p,bytes,false); + bool rp = parse((const char *)p,bytes,false); + if(!rp) { + skipping = -1; + bytes = 0; + } return bytes; } size_t header(void *p,size_t s,size_t nm) { @@ -225,7 +230,7 @@ namespace opkele { }else if(xmode&xmode_html) { html_start_element(n,a); }else{ - skipping = -1; + skipping = -1; stop_parser(); } }else{ int pt_s = pt_stack.size(); @@ -310,14 +315,15 @@ namespace opkele { if(is_qelement(pt_stack.back().c_str(),n)) { assert(cdata==&status_string); pt_stack.pop_back(); - if(status_code!=100) - skipping = -1; + if(status_code!=100) { + skipping = -1; stop_parser(); + } } }else if(is_qelement(n,NSURI_XRD "\tExpires")) { assert(xrd); xrd->expires = util::w3c_to_time(cdata_buf); }else if((xmode&xmode_html) && is_element(n,"head")) { - skipping = -1; + skipping = -1; stop_parser(); } cdata = 0; } @@ -374,7 +380,7 @@ namespace opkele { html_openid2.local_ids.add(-1,href); } }else if(is_element(n,"body")) { - skipping = -1; + skipping = -1; stop_parser(); } } -- cgit v0.9.0.2