Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
bc36b700
Commit
bc36b700
authored
Nov 13, 2013
by
Simon Morlat
Browse files
add option to force content-length even for UDP
parent
7feb9aa8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/provider.c
View file @
bc36b700
...
...
@@ -325,7 +325,7 @@ static int channel_on_auth_requested(belle_sip_channel_listener_t *obj, belle_si
static
void
channel_on_sending
(
belle_sip_channel_listener_t
*
obj
,
belle_sip_channel_t
*
chan
,
belle_sip_message_t
*
msg
){
belle_sip_header_contact_t
*
contact
;
belle_sip_header_content_length_t
*
content_leng
h
t
=
(
belle_sip_header_content_length_t
*
)
belle_sip_message_get_header
(
msg
,
"Content-Length"
);
belle_sip_header_content_length_t
*
content_lengt
h
=
(
belle_sip_header_content_length_t
*
)
belle_sip_message_get_header
(
msg
,
"Content-Length"
);
belle_sip_uri_t
*
contact_uri
;
const
belle_sip_list_t
*
contacts
;
const
char
*
ip
=
NULL
;
...
...
@@ -376,10 +376,18 @@ static void channel_on_sending(belle_sip_channel_listener_t *obj, belle_sip_chan
belle_sip_uri_set_port
(
contact_uri
,
0
);
}
}
if
(
!
content_lenght
&&
strcasecmp
(
"udp"
,
belle_sip_channel_get_transport_name
(
chan
))
!=
0
)
{
content_lenght
=
belle_sip_header_content_length_create
(
0
);
belle_sip_message_add_header
(
msg
,(
belle_sip_header_t
*
)
content_lenght
);
/*
* According to RFC3261, content-length is mandatory for stream based transport, but optional for datagram transport.
* However some servers (opensips) are confused when they receive a SIP/UDP packet without Content-Length (they shouldn't).
*/
if
(
!
content_length
#ifndef BELLE_SIP_FORCE_CONTENT_LENGTH
&&
strcasecmp
(
"udp"
,
belle_sip_channel_get_transport_name
(
chan
))
!=
0
#endif
)
{
content_length
=
belle_sip_header_content_length_create
(
0
);
belle_sip_message_add_header
(
msg
,(
belle_sip_header_t
*
)
content_length
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment