Fixed the http response parser when the http header only has the HTTP

answer and no field.
Fixed some compiler warnings.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4817 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
bertrand 2002-02-23 07:31:45 +00:00
parent 64ae87b5e4
commit 646c35a06e
1 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#include <string.h> #include <string.h>
#include "http.h" #include "http.h"
#include "url.h"
HTTP_header_t * HTTP_header_t *
http_new_header() { http_new_header() {
@ -146,6 +147,7 @@ http_response_parse( HTTP_header_t *http_hdr ) {
ptr = hdr_ptr; ptr = hdr_ptr;
while( *ptr!='\r' && *ptr!='\n' ) ptr++; while( *ptr!='\r' && *ptr!='\n' ) ptr++;
len = ptr-hdr_ptr; len = ptr-hdr_ptr;
if( len==0 ) break;
field = (char*)realloc(field, len+1); field = (char*)realloc(field, len+1);
if( field==NULL ) { if( field==NULL ) {
printf("Memory allocation failed\n"); printf("Memory allocation failed\n");
@ -256,7 +258,6 @@ http_get_field( HTTP_header_t *http_hdr, const char *field_name ) {
char * char *
http_get_next_field( HTTP_header_t *http_hdr ) { http_get_next_field( HTTP_header_t *http_hdr ) {
char *ptr; char *ptr;
int i;
HTTP_field_t *field; HTTP_field_t *field;
if( http_hdr==NULL ) return NULL; if( http_hdr==NULL ) return NULL;