Changeset 4830:fb6bb2abfcc5 in roaraudio


Ignore:
Timestamp:
04/03/11 10:50:04 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

corrected handling of HTTP headers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/vio_proto.c

    r4828 r4830  
    291291} 
    292292 
    293 static int _parse_header(struct roar_keyval * kv, char ** buf, int * aligned) { 
     293static int _parse_header(struct roar_keyval * kv, char ** buf, int * aligned, char * endofheader) { 
    294294 char * p = *buf; 
    295295 char   c = 0; 
     
    302302 } 
    303303 
     304 if ( p >= endofheader ) 
     305  return -1; 
     306 
    304307 kv->key = p; 
    305308 
     
    307310 
    308311 if ( *p == 0 ) 
     312  return -1; 
     313 
     314 if ( p >= endofheader ) 
    309315  return -1; 
    310316 
     
    337343 
    338344 if ( *p == 0 ) 
     345  return -1; 
     346 
     347 if ( p >= endofheader ) 
    339348  return -1; 
    340349 
     
    425434 } 
    426435 
     436 ROAR_DBG("roar_vio_open_proto_http(*): got %i bytes from server.", len); 
     437 
    427438 buf[len] = 0; 
    428439 
     
    434445  return -1; 
    435446 } 
     447 
     448 ROAR_DBG("roar_vio_open_proto_http(*): b0='%s'", b0); 
    436449 
    437450 ROAR_DBG("roar_vio_open_proto_http(*) = ?"); 
     
    455468 
    456469 p = buf; 
    457  while ( _parse_header(&kv, &p, &aligned) > 0 ) 
     470 while ( _parse_header(&kv, &p, &aligned, endofheader) > 0 ) 
    458471  if ( aligned ) 
    459472   _handle_header(self, &kv); 
     
    471484 
    472485/* Doesn't work good. 
    473   while ( _parse_header(&kv, &p, &aligned) > 0 ) 
     486  while ( _parse_header(&kv, &p, &aligned, endofheader) > 0 ) 
    474487   if ( aligned ) 
    475488    _handle_header(self, &kv); 
    476489*/ 
    477490 
     491  p = buf; 
     492  while ( _parse_header(&kv, &p, &aligned, endofheader) > 0 ) 
     493   if ( aligned ) 
     494    _handle_header(self, &kv); 
     495 
    478496  ROAR_DBG("roar_vio_open_proto_http(*): endofheader=%p\n", endofheader); 
    479497 } 
Note: See TracChangeset for help on using the changeset viewer.