Commit 19e4ff7d authored by Simon Morlat's avatar Simon Morlat
Browse files

fix bug in http (not chunked) download handling

parent a526881e
......@@ -371,9 +371,10 @@ static int check_body(belle_sip_channel_t *obj){
obj->input_stream.content_length= content_length_header ? belle_sip_header_content_length_get_content_length(content_length_header) : 0;
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(msg,belle_sip_response_t) || BELLE_SIP_OBJECT_IS_INSTANCE_OF(msg,belle_sip_request_t)){
expect_body=obj->input_stream.content_length>0;
}else{/*http*/
expect_body=obj->input_stream.content_length>0;
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(msg,belle_http_response_t) || BELLE_SIP_OBJECT_IS_INSTANCE_OF(msg,belle_http_request_t)){
/*http chunked mode handling*/
if (belle_sip_message_get_header_by_type(msg, belle_sip_header_content_type_t)!=NULL){
belle_sip_header_t *transfer_encoding=belle_sip_message_get_header(msg,"Transfer-Encoding");
......
......@@ -32,6 +32,8 @@ static belle_sip_stack_t *stack=NULL;
static void process_response(void *data, const belle_http_response_event_t *event){
belle_http_response_t *resp=event->response;
const char *body=belle_sip_message_get_body(BELLE_SIP_MESSAGE(resp));
fprintf(stdout,"Got response:\n");
if (body){
fprintf(stdout,"%s",body);
}
......@@ -66,12 +68,14 @@ int main(int argc, char *argv[]){
if (argc<2){
usage(argv[0]);
}
bctbx_init_logger(1);
for (i = 2; i < argc; ++i){
if (strcmp(argv[i], "--ca-path") == 0){
i++;
ca_path = argv[i];
}else if (strcmp(argv[i], "--debug")==0){
belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG);
fprintf(stderr, "Logs are enabled.\n");
bctbx_set_log_level(BCTBX_LOG_DOMAIN,BCTBX_LOG_DEBUG);
}else if (strcmp(argv[i], "--no-tls-check")==0){
check_tls = 0;
}else{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment