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
e240481b
Commit
e240481b
authored
Oct 08, 2014
by
jehan
Browse files
fix message parser for headers with CRLF SP sequence
parent
5763f61e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
8 deletions
+21
-8
include/belle-sip/object.h
include/belle-sip/object.h
+2
-2
include/belle-sip/sip-uri.h
include/belle-sip/sip-uri.h
+2
-2
src/grammars/belle_sip_message.g
src/grammars/belle_sip_message.g
+1
-1
tester/belle_sip_headers_tester.c
tester/belle_sip_headers_tester.c
+15
-2
tester/belle_sip_message_tester.c
tester/belle_sip_message_tester.c
+1
-1
No files found.
include/belle-sip/object.h
View file @
e240481b
...
...
@@ -483,8 +483,8 @@ BELLE_SIP_END_DECLS
#if defined(__cplusplus) && defined(BELLE_SIP_USE_STL)
#include <ostream>
inline
ostream
&
operator
<<
(
ostream
&
__os
,
const
belle_sip_object_t
*
object
)
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
__os
,
const
belle_sip_object_t
*
object
)
{
char
*
object_as_string
=
belle_sip_object_to_string
((
void
*
)
object
);
__os
<<
object_as_string
;
...
...
include/belle-sip/sip-uri.h
View file @
e240481b
...
...
@@ -222,8 +222,8 @@ BELLE_SIP_END_DECLS
#if defined(__cplusplus) && defined(BELLE_SIP_USE_STL)
#include <ostream>
inline
ostream
&
operator
<<
(
ostream
&
__os
,
const
belle_sip_uri_t
*
uri
)
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
__os
,
const
belle_sip_uri_t
*
uri
)
{
char
*
uri_as_string
=
belle_sip_uri_to_string
(
uri
);
__os
<<
uri_as_string
;
...
...
src/grammars/belle_sip_message.g
View file @
e240481b
...
...
@@ -1373,7 +1373,7 @@ header_name
header_value[const char* name, ANTLR3_BOOLEAN is_http] returns [belle_sip_header_t* ret]
options { greedy = false; }
@init {$ret=NULL;}
: (~(SP|CRLF)
~
(CRLF)* ) {
: (~(SP|CRLF) (
(CRLF SP) | ~
CRLF)* ) {
if ($is_http) {
$ret=belle_http_header_create($name,(const char*)$header_value.text->chars);
}else {
...
...
tester/belle_sip_headers_tester.c
View file @
e240481b
...
...
@@ -489,10 +489,14 @@ static void check_header_authenticate(belle_sip_header_www_authenticate_t* authe
static
void
test_www_authenticate_header
(
void
)
{
const
char
*
l_header
=
"WWW-Authenticate: Digest "
"algorithm=MD5, realm=
\"
atlanta.com
\"
, opaque=
\"
1bc7f9097684320
\"
,"
"algorithm=MD5,
\r\n
realm=
\"
atlanta.com
\"
,
\r\n
opaque=
\"
1bc7f9097684320
\"
,"
" qop=
\"
auth,auth-int
\"
, nonce=
\"
c60f3082ee1212b402a21831ae
\"
, stale=true, domain=
\"
sip:boxesbybob.com
\"
"
;
const
char
*
l_header_1
=
"WWW-Authenticate: Digest realm=
\"
toto.com
\"
,
\r\n
nonce=
\"
b543409177c9036dbf3054aea940e9703dc8f84c0108
\"
"
",
\r\n
opaque=
\"
ALU:QbkRBthOEgEQAkgVEwwHRAIBHgkdHwQCQ1lFRkRWEAkic203MSEzJCgoZS8iI3VlYWRj
\"
,
\r\n
algorithm=MD5"
",
\r\n
qop=
\"
auth
\"
"
;
belle_sip_header_www_authenticate_t
*
L_tmp
;
belle_sip_header_www_authenticate_t
*
l_authenticate
=
belle_sip_header_www_authenticate_parse
(
l_header
);
belle_sip_header_www_authenticate_t
*
l_authenticate
=
belle_sip_header_www_authenticate_parse
(
l_header
);
char
*
l_raw_header
=
belle_sip_object_to_string
(
BELLE_SIP_OBJECT
(
l_authenticate
));
...
...
@@ -502,6 +506,15 @@ static void test_www_authenticate_header(void) {
belle_sip_object_unref
(
BELLE_SIP_OBJECT
(
L_tmp
));
belle_sip_free
(
l_raw_header
);
check_header_authenticate
(
l_authenticate
);
l_authenticate
=
belle_sip_header_www_authenticate_parse
(
l_header_1
);
l_raw_header
=
belle_sip_object_to_string
(
BELLE_SIP_OBJECT
(
l_authenticate
));
belle_sip_object_unref
(
BELLE_SIP_OBJECT
(
l_authenticate
));
L_tmp
=
belle_sip_header_www_authenticate_parse
(
l_raw_header
);
l_authenticate
=
BELLE_SIP_HEADER_WWW_AUTHENTICATE
(
belle_sip_object_clone
(
BELLE_SIP_OBJECT
(
L_tmp
)));
belle_sip_object_unref
(
BELLE_SIP_OBJECT
(
l_authenticate
));
CU_ASSERT_PTR_NULL
(
belle_sip_header_www_authenticate_parse
(
"nimportequoi"
));
}
...
...
tester/belle_sip_message_tester.c
View file @
e240481b
...
...
@@ -152,7 +152,7 @@ static void test401ResponseWithoutResponsePhrase(void) {
"Server: Cirpack/v4.42x (gw_sip)
\r\n
"
"To: <sip:0033482176@sip.ovh.net>;tag=00-08075-24212984-22e348d97
\r\n
"
"Via: SIP/2.0/UDP 192.168.0.18:5062;received=81.56.113.2;rport=5062;branch=z9hG4bK1939354046
\r\n
"
"WWW-Authenticate: Digest realm=
\"
sip.ovh.net
\"
,nonce=
\"
24212965507cde726e8bc37e04686459
\"
,opaque=
\"
241b9fb347752f2
\"
,stale=false,algorithm=MD5
\r\n
"
"WWW-Authenticate: Digest realm=
\"
sip.ovh.net
\"
,
\r\n
nonce=
\"
24212965507cde726e8bc37e04686459
\"
,opaque=
\"
241b9fb347752f2
\"
,stale=false,algorithm=MD5
\r\n
"
"Content-Length: 0
\r\n\r\n
"
;
belle_sip_response_t
*
response
;
belle_sip_message_t
*
message
=
belle_sip_message_parse
(
raw_message
);
...
...
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