Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[mod_sofia] Set the proper content-length for multipart messages
Before any custom headers set via `sip_multipart` would be included in the size calculation.
  • Loading branch information
winsock authored and root committed Jan 11, 2021
commit ffee18ff826694e855d0122e6b324a73dd4ebce7
5 changes: 4 additions & 1 deletion src/mod/endpoints/mod_sofia/sofia_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ static void process_mp(switch_core_session_t *session, switch_stream_handle_t *s
if ((dval = strchr(dname, ':'))) {
*dval++ = '\0';
if (*dval == '~') {
stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n", boundary, dname, strlen(dval), dval + 1);
char *body;
if ((body = strstr(dval, "\r\n\r\n"))) {
stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n", boundary, dname, strlen(body + 4) + 1, dval + 1);
}
} else {
stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s\r\n", boundary, dname, strlen(dval) + 1, dval);
}
Expand Down