diff options
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/http_client.c | 21 | ||||
| -rw-r--r-- | protocols/http_client.h | 1 | 
2 files changed, 13 insertions, 9 deletions
| diff --git a/protocols/http_client.c b/protocols/http_client.c index 46cb8b7b..49e6dd83 100644 --- a/protocols/http_client.c +++ b/protocols/http_client.c @@ -252,21 +252,24 @@ got_reply:  		end1 = end2 + 1;  		evil_server = 1;  	} -	else +	else if( end1 )  	{  		end1 += 2;  	} -	 -	if( end1 ) +	else  	{ -		*end1 = 0; -		 -		if( evil_server ) -			req->reply_body = end1 + 1; -		else -			req->reply_body = end1 + 2; +		goto cleanup;  	} +	*end1 = 0; +	 +	if( evil_server ) +		req->reply_body = end1 + 1; +	else +		req->reply_body = end1 + 2; +	 +	req->body_size = req->reply_headers + bytes_read - req->reply_body; +	  	if( ( end1 = strchr( req->reply_headers, ' ' ) ) != NULL )  	{  		if( sscanf( end1 + 1, "%d", &req->status_code ) != 1 ) diff --git a/protocols/http_client.h b/protocols/http_client.h index 0935b5f6..860cdd86 100644 --- a/protocols/http_client.h +++ b/protocols/http_client.h @@ -38,6 +38,7 @@ struct http_request  	int status_code;  	char *reply_headers;  	char *reply_body; +	int body_size;  	int finished;  	void *ssl; | 
