- Timestamp:
- 2012-11-11T17:57:20Z (12 years ago)
- Branches:
- master
- Children:
- 2fb1262
- Parents:
- 62f6b45
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/http_client.c
r62f6b45 r1388d30 568 568 void http_flush_bytes( struct http_request *req, size_t len ) 569 569 { 570 if( len > 0 && len <= req->body_size ) 571 { 572 req->reply_body += len; 573 req->body_size -= len; 574 } 570 if( len <= 0 || len > req->body_size || !( req->flags & HTTPC_STREAMING ) ) 571 return; 572 573 req->reply_body += len; 574 req->body_size -= len; 575 576 if( req->reply_body - req->sbuf >= 512 ) 577 { 578 printf( "Wasting %ld bytes, cleaning up stream buffer\n", req->reply_body - req->sbuf ); 579 char *new = g_memdup( req->reply_body, req->body_size + 1 ); 580 g_free( req->sbuf ); 581 req->reply_body = req->sbuf = new; 582 req->sblen = req->body_size; 583 } 584 } 585 586 void http_close( struct http_request *req ) 587 { 588 if( !req ) 589 return; 590 591 if( req->ssl ) 592 ssl_disconnect( req->ssl ); 593 else 594 closesocket( req->fd ); 595 596 http_free( req ); 575 597 } 576 598 -
lib/http_client.h
r62f6b45 r1388d30 89 89 /* For streaming connections only; flushes len bytes at the start of the buffer. */ 90 90 void http_flush_bytes( struct http_request *req, size_t len ); 91 void http_close( struct http_request *req );
Note: See TracChangeset
for help on using the changeset viewer.