summaryrefslogtreecommitdiffabout
path: root/lib
Unidiff
Diffstat (limited to 'lib') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/discovery.cc41
1 files changed, 26 insertions, 15 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc
index cbdceb3..f8a3988 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -449,35 +449,46 @@ namespace opkele {
449 } 449 }
450 } 450 }
451 void end_element(const XML_Char *n) { 451 void end_element(const XML_Char *n) {
452 if(skipping<0) return; 452 if(skipping<0) return;
453 if(skipping) { 453 if(skipping) {
454 --skipping; return; 454 --skipping; return;
455 } 455 }
456 if(is_qelement(n,NSURI_XRD "\tType")) { 456 if(is_qelement(n,NSURI_XRD "\tType")) {
457 assert(xrd); assert(xrd_service); assert(cdata==&cdata_buf); 457 if(xrd && xrd_service) {
458 xrd_service->types.insert(cdata_buf); 458 assert(cdata==&cdata_buf);
459 xrd_service->types.insert(cdata_buf);
460 }
459 }else if(is_qelement(n,NSURI_XRD "\tService")) { 461 }else if(is_qelement(n,NSURI_XRD "\tService")) {
460 assert(xrd); assert(xrd_service); 462 if(!(xrd && xrd_service)) {
461 assert(!pt_stack.empty()); 463 skipping = -1;
462 assert(pt_stack.back()==(NSURI_XRD "\tService")); 464 }else{
463 pt_stack.pop_back(); 465 assert(!pt_stack.empty());
464 xrd_service = 0; 466 assert(pt_stack.back()==(NSURI_XRD "\tService"));
465 }else if(is_qelement(n,NSURI_XRD "\tStatus")) {
466 assert(xrd);
467 if(is_qelement(pt_stack.back().c_str(),n)) {
468 assert(cdata==&status_string);
469 pt_stack.pop_back(); 467 pt_stack.pop_back();
470 if(status_code!=100) 468 xrd_service = 0;
471 skipping = -1; 469 }
470 }else if(is_qelement(n,NSURI_XRD "\tStatus")) {
471 if(!xrd) {
472 skipping=-1;
473 }else{
474 if(is_qelement(pt_stack.back().c_str(),n)) {
475 assert(cdata==&status_string);
476 pt_stack.pop_back();
477 if(status_code!=100)
478 skipping = -1;
479 }
472 } 480 }
473 }else if(is_qelement(n,NSURI_XRD "\tExpires")) { 481 }else if(is_qelement(n,NSURI_XRD "\tExpires")) {
474 assert(xrd); 482 if(!xrd) {
475 xrd->expires = util::w3c_to_time(cdata_buf); 483 skipping=-1;
484 }else{
485 xrd->expires = util::w3c_to_time(cdata_buf);
486 }
476 }else if((xmode&xmode_html) && is_element(n,"head")) { 487 }else if((xmode&xmode_html) && is_element(n,"head")) {
477 skipping = -1; 488 skipping = -1;
478 } 489 }
479 cdata = 0; 490 cdata = 0;
480 } 491 }
481 void character_data(const XML_Char *s,int l) { 492 void character_data(const XML_Char *s,int l) {
482 if(skipping) return; 493 if(skipping) return;
483 if(cdata) cdata->append(s,l); 494 if(cdata) cdata->append(s,l);