Commit 093a6632 authored by johan's avatar johan
Browse files

Multipart message: bellesip now manages message header to insert boundary

parent 6e121e37
......@@ -589,6 +589,7 @@ belle_http_provider_t *belle_http_provider_new(belle_sip_stack_t *s, const char
/*
* SIP and http messages
**/
#define BELLESIP_MULTIPART_BOUNDARY "---------------------------14737809831466499882746641449"
void belle_sip_message_init(belle_sip_message_t *message);
......
......@@ -264,9 +264,8 @@ belle_sip_user_body_handler_t *belle_sip_user_body_handler_new(
* TODO
**/
#define MULTIPART_BOUNDARY "---------------------------14737809831466499882746641449"
#define MULTIPART_SEPARATOR "--" MULTIPART_BOUNDARY "\r\n"
#define MULTIPART_END "\r\n--" MULTIPART_BOUNDARY "--\r\n"
#define MULTIPART_SEPARATOR "--" BELLESIP_MULTIPART_BOUNDARY "\r\n"
#define MULTIPART_END "\r\n--" BELLESIP_MULTIPART_BOUNDARY "--\r\n"
struct belle_sip_multipart_body_handler{
belle_sip_body_handler_t base;
belle_sip_list_t *parts;
......
......@@ -415,6 +415,15 @@ belle_sip_body_handler_t *belle_sip_message_get_body_handler(const belle_sip_mes
}
void belle_sip_message_set_body_handler(belle_sip_message_t *msg, belle_sip_body_handler_t *body_handler){
/* In case of multipart message, we must add the message Content-Type header containing the boundary */
if (body_handler != NULL) {
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(body_handler, belle_sip_multipart_body_handler_t)){
char *content_type = belle_sip_strdup_printf("multipart/form-data; boundary=%s",BELLESIP_MULTIPART_BOUNDARY);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(msg), belle_sip_header_create("Content-type",content_type));
belle_sip_free(content_type);
}
}
SET_OBJECT_PROPERTY(msg,body_handler,body_handler);
}
......
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