Commit 883c11eb authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Improved code

parent 1807c18b
......@@ -408,25 +408,20 @@ static int check_body(belle_sip_channel_t *obj){
belle_sip_header_content_type_t *content_type = belle_sip_message_get_header_by_type(msg, belle_sip_header_content_type_t);
if (content_encoding) {
bh = (belle_sip_body_handler_t *)belle_sip_memory_body_handler_new(NULL, NULL);
belle_sip_body_handler_add_header(bh,BELLE_SIP_HEADER(content_length_header));
belle_sip_body_handler_add_header(bh, BELLE_SIP_HEADER(content_type));
belle_sip_body_handler_add_header(bh, content_encoding);
belle_sip_message_set_body_handler(msg, bh);
} else if (content_type
&& (strcmp(belle_sip_header_content_type_get_type(content_type), "multipart") == 0)) {
} else if (content_type && (strcmp(belle_sip_header_content_type_get_type(content_type), "multipart") == 0)) {
const char *unparsed_value = belle_sip_header_get_unparsed_value(BELLE_SIP_HEADER(content_type));
const char *boundary = strstr(unparsed_value, ";boundary=");
if (boundary) boundary += 10;
if (boundary[0] == '\0') boundary = NULL;
bh = (belle_sip_body_handler_t *)belle_sip_multipart_body_handler_new(belle_sip_multipart_body_handler_progress_cb, NULL, NULL, boundary);
belle_sip_body_handler_set_size(bh, obj->input_stream.content_length);
belle_sip_body_handler_add_header(bh, BELLE_SIP_HEADER(content_length_header));
belle_sip_body_handler_add_header(bh, BELLE_SIP_HEADER(content_type));
belle_sip_message_set_body_handler(msg, bh);
} else {
bh = (belle_sip_body_handler_t *)belle_sip_memory_body_handler_new(NULL, NULL);
belle_sip_message_set_body_handler(msg, bh);
}
belle_sip_body_handler_set_size(bh, obj->input_stream.content_length);
belle_sip_body_handler_add_header(bh, BELLE_SIP_HEADER(content_length_header));
belle_sip_body_handler_add_header(bh, BELLE_SIP_HEADER(content_type));
belle_sip_message_set_body_handler(msg, bh);
}
belle_sip_body_handler_begin_recv_transfer(bh);
}
......
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