summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2008-12-02 21:36:54 (UTC)
committer Michael Krelin <hacker@klever.net>2008-12-02 21:36:54 (UTC)
commita2a524f744849e81ec91a7afbaf641d1b57e14b1 (patch) (unidiff)
treed023154d9485179fdd3001d5816a0ebec05e5d5c
parent47bf5ab634dc5cc3bd5d71894b2d6681f7a83024 (diff)
downloadlibopkele-a2a524f744849e81ec91a7afbaf641d1b57e14b1.zip
libopkele-a2a524f744849e81ec91a7afbaf641d1b57e14b1.tar.gz
libopkele-a2a524f744849e81ec91a7afbaf641d1b57e14b1.tar.bz2
added passthrough unknown encoding handler to discovery parser
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/discovery.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc
index bd1f917..cbdceb3 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -274,24 +274,25 @@ namespace opkele {
274 throw exception_tidy(OPKELE_CP_ "tidy failed to save buffer"); 274 throw exception_tidy(OPKELE_CP_ "tidy failed to save buffer");
275 prepare_to_parse(); 275 prepare_to_parse();
276 parse(tide.c_str(),tide.size(),true); 276 parse(tide.c_str(),tide.size(),true);
277 }catch(exception_tidy& et) { } 277 }catch(exception_tidy& et) { }
278 } 278 }
279 save_html.clear(); 279 save_html.clear();
280 } 280 }
281 281
282 void prepare_to_parse() { 282 void prepare_to_parse() {
283 (*(expat_t*)this) = parser_create_ns(); 283 (*(expat_t*)this) = parser_create_ns();
284 set_user_data(); set_element_handler(); 284 set_user_data(); set_element_handler();
285 set_character_data_handler(); 285 set_character_data_handler();
286 set_unknown_encoding_handler();
286 287
287 if(xmode&xmode_html) { 288 if(xmode&xmode_html) {
288 html_openid1.clear(); html_openid2.clear(); 289 html_openid1.clear(); html_openid2.clear();
289 parser_choked = false; 290 parser_choked = false;
290 } 291 }
291 292
292 cdata = 0; xrd_service = 0; skipping = 0; 293 cdata = 0; xrd_service = 0; skipping = 0;
293 pt_stack.clear(); 294 pt_stack.clear();
294 status_code = 100; status_string.clear(); 295 status_code = 100; status_string.clear();
295 } 296 }
296 297
297 void html2xrd(endpoint_discovery_iterator& oi,idiscovery_t& id) { 298 void html2xrd(endpoint_discovery_iterator& oi,idiscovery_t& id) {
@@ -560,24 +561,31 @@ namespace opkele {
560 }else{ 561 }else{
561 for(xrd::local_ids_t::const_iterator ilid=svc.local_ids.begin(); 562 for(xrd::local_ids_t::const_iterator ilid=svc.local_ids.begin();
562 ilid!=svc.local_ids.end(); ++ilid) { 563 ilid!=svc.local_ids.end(); ++ilid) {
563 ep.local_id = ilid->second; 564 ep.local_id = ilid->second;
564 *(oi++) = ep; 565 *(oi++) = ep;
565 } 566 }
566 } 567 }
567 } 568 }
568 } 569 }
569 } 570 }
570 } 571 }
571 572
573 int unknown_encoding(const XML_Char *n,XML_Encoding *i) {
574 for(int ii=0;ii < sizeof(i->map)/sizeof(i->map[0]);++ii)
575 i->map[ii] = ii;
576 i->convert = 0; i->release = 0;
577 return XML_STATUS_OK;
578 }
579
572 }; 580 };
573 581
574 string idiscover(endpoint_discovery_iterator oi,const string& identity) { 582 string idiscover(endpoint_discovery_iterator oi,const string& identity) {
575 idigger_t idigger; 583 idigger_t idigger;
576 return idigger.discover(oi,identity); 584 return idigger.discover(oi,identity);
577 } 585 }
578 586
579 void yadiscover(endpoint_discovery_iterator oi,const string& yurl,const char **types,bool redirs) try { 587 void yadiscover(endpoint_discovery_iterator oi,const string& yurl,const char **types,bool redirs) try {
580 idigger_t idigger; 588 idigger_t idigger;
581 idigger.yadiscover(oi,yurl,types,redirs); 589 idigger.yadiscover(oi,yurl,types,redirs);
582 }catch(exception_curl& ec) { 590 }catch(exception_curl& ec) {
583 if(redirs || ec._error!=CURLE_TOO_MANY_REDIRECTS) 591 if(redirs || ec._error!=CURLE_TOO_MANY_REDIRECTS)