-rw-r--r-- | lib/discovery.cc | 2 |
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 | |||
@@ -317,33 +317,33 @@ namespace opkele { | |||
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 | } |