summaryrefslogtreecommitdiffabout
path: root/lib/discovery.cc
Unidiff
Diffstat (limited to 'lib/discovery.cc') (more/less context) (show whitespace changes)
-rw-r--r--lib/discovery.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc
index 6f58339..6f9926c 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -309,49 +309,49 @@ namespace opkele {
309 bts = (bytes>mbts)?mbts:bytes; 309 bts = (bytes>mbts)?mbts:bytes;
310 save_html.append(inbuf,bts); 310 save_html.append(inbuf,bts);
311 } 311 }
312 if(skipping<0) return bts; 312 if(skipping<0) return bts;
313 } 313 }
314 if(skipping<0) return 0; 314 if(skipping<0) return 0;
315 bool rp = parse(inbuf,bytes,false); 315 bool rp = parse(inbuf,bytes,false);
316 if(!rp) { 316 if(!rp) {
317 parser_choked = true; 317 parser_choked = true;
318 skipping = -1; 318 skipping = -1;
319 if(!(xmode&xmode_html)) 319 if(!(xmode&xmode_html))
320 bytes = 0; 320 bytes = 0;
321 } 321 }
322 return bytes; 322 return bytes;
323 } 323 }
324 size_t header(void *p,size_t s,size_t nm) { 324 size_t header(void *p,size_t s,size_t nm) {
325 size_t bytes = s*nm; 325 size_t bytes = s*nm;
326 const char *h = (const char*)p; 326 const char *h = (const char*)p;
327 const char *colon = (const char*)memchr(p,':',bytes); 327 const char *colon = (const char*)memchr(p,':',bytes);
328 const char *space = (const char*)memchr(p,' ',bytes); 328 const char *space = (const char*)memchr(p,' ',bytes);
329 if(space && ( (!colon) || space<colon ) ) { 329 if(space && ( (!colon) || space<colon ) ) {
330 xrds_location.clear(); http_content_type.clear(); 330 xrds_location.clear(); http_content_type.clear();
331 }else if(colon) { 331 }else if(colon) {
332 const char *hv = ++colon; 332 const char *hv = ++colon;
333 int hnl = colon-h; 333 size_t hnl = colon-h;
334 int rb; 334 int rb;
335 for(rb = bytes-hnl-1;rb>0 && isspace(*hv);++hv,--rb); 335 for(rb = bytes-hnl-1;rb>0 && isspace(*hv);++hv,--rb);
336 while(rb>0 && isspace(hv[rb-1])) --rb; 336 while(rb>0 && isspace(hv[rb-1])) --rb;
337 if(rb) { 337 if(rb) {
338 if( (hnl>=sizeof(XRDS_HEADER)) 338 if( (hnl>=sizeof(XRDS_HEADER))
339 && !strncasecmp(h,XRDS_HEADER":", 339 && !strncasecmp(h,XRDS_HEADER":",
340 sizeof(XRDS_HEADER)) ) { 340 sizeof(XRDS_HEADER)) ) {
341 xrds_location.assign(hv,rb); 341 xrds_location.assign(hv,rb);
342 }else if( (hnl>=sizeof(CT_HEADER)) 342 }else if( (hnl>=sizeof(CT_HEADER))
343 && !strncasecmp(h,CT_HEADER":", 343 && !strncasecmp(h,CT_HEADER":",
344 sizeof(CT_HEADER)) ) { 344 sizeof(CT_HEADER)) ) {
345 const char *sc = (const char*)memchr( 345 const char *sc = (const char*)memchr(
346 hv,';',rb); 346 hv,';',rb);
347 http_content_type.assign(hv,sc?(sc-hv):rb); 347 http_content_type.assign(hv,sc?(sc-hv):rb);
348 } 348 }
349 } 349 }
350 } 350 }
351 return curl_t::header(p,s,nm); 351 return curl_t::header(p,s,nm);
352 } 352 }
353 353
354 void start_element(const XML_Char *n,const XML_Char **a) { 354 void start_element(const XML_Char *n,const XML_Char **a) {
355 if(skipping<0) return; 355 if(skipping<0) return;
356 if(skipping) { 356 if(skipping) {
357 if(xmode&xmode_html) 357 if(xmode&xmode_html)