-rw-r--r-- | lib/discovery.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc index 984e308..bd1f917 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -240,35 +240,38 @@ namespace opkele { | |||
240 | save_html.reserve(max_html); | 240 | save_html.reserve(max_html); |
241 | } | 241 | } |
242 | xrd = &idis.xrd; | 242 | xrd = &idis.xrd; |
243 | 243 | ||
244 | r = easy_perform(); | 244 | r = easy_perform(); |
245 | if(r && r!=CURLE_WRITE_ERROR) | 245 | if(r && r!=CURLE_WRITE_ERROR) |
246 | throw exception_curl(OPKELE_CP_ "failed to perform curly request",r); | 246 | throw exception_curl(OPKELE_CP_ "failed to perform curly request",r); |
247 | 247 | ||
248 | if(!parser_choked) { | 248 | if(!parser_choked) { |
249 | parse(0,0,true); | 249 | parse(0,0,true); |
250 | }else if(xmode&xmode_html){ | 250 | }else if(xmode&xmode_html){ |
251 | /* TODO: do not bother if we've seen xml */ | 251 | /* TODO: do not bother if we've seen xml */ |
252 | try { | 252 | try { |
253 | util::tidy_doc_t td = util::tidy_doc_t::create(); | 253 | util::tidy_doc_t td = util::tidy_doc_t::create(); |
254 | if(!td) | 254 | if(!td) |
255 | throw exception_tidy(OPKELE_CP_ "failed to create htmltidy document"); | 255 | throw exception_tidy(OPKELE_CP_ "failed to create htmltidy document"); |
256 | #ifndef NDEBUG | 256 | #ifdef NDEBUG |
257 | td.opt_set(TidyQuiet,false); | 257 | td.opt_set(TidyQuiet,true); |
258 | td.opt_set(TidyShowWarnings,false); | 258 | td.opt_set(TidyShowWarnings,false); |
259 | #else /* NDEBUG */ | ||
260 | td.opt_set(TidyQuiet,false); | ||
261 | td.opt_set(TidyShowWarnings,true); | ||
259 | #endif /* NDEBUG */ | 262 | #endif /* NDEBUG */ |
260 | td.opt_set(TidyForceOutput,true); | 263 | td.opt_set(TidyForceOutput,true); |
261 | td.opt_set(TidyXhtmlOut,true); | 264 | td.opt_set(TidyXhtmlOut,true); |
262 | td.opt_set(TidyDoctypeMode,TidyDoctypeOmit); | 265 | td.opt_set(TidyDoctypeMode,TidyDoctypeOmit); |
263 | td.opt_set(TidyMark,false); | 266 | td.opt_set(TidyMark,false); |
264 | td.opt_set(TidyNumEntities,true); | 267 | td.opt_set(TidyNumEntities,true); |
265 | if(td.parse_string(save_html)<=0) | 268 | if(td.parse_string(save_html)<=0) |
266 | throw exception_tidy(OPKELE_CP_ "tidy failed to parse document"); | 269 | throw exception_tidy(OPKELE_CP_ "tidy failed to parse document"); |
267 | if(td.clean_and_repair()<=0) | 270 | if(td.clean_and_repair()<=0) |
268 | throw exception_tidy(OPKELE_CP_ "tidy failed to clean and repair"); | 271 | throw exception_tidy(OPKELE_CP_ "tidy failed to clean and repair"); |
269 | util::tidy_buf_t tide; | 272 | util::tidy_buf_t tide; |
270 | if(td.save_buffer(tide)<=0) | 273 | if(td.save_buffer(tide)<=0) |
271 | throw exception_tidy(OPKELE_CP_ "tidy failed to save buffer"); | 274 | throw exception_tidy(OPKELE_CP_ "tidy failed to save buffer"); |
272 | prepare_to_parse(); | 275 | prepare_to_parse(); |
273 | parse(tide.c_str(),tide.size(),true); | 276 | parse(tide.c_str(),tide.size(),true); |
274 | }catch(exception_tidy& et) { } | 277 | }catch(exception_tidy& et) { } |