Commit e26d9233 authored by jehan's avatar jehan

fix fast uri parser in case of domain starting by a numerical value

parent f1856679
......@@ -1815,10 +1815,10 @@ fast_host returns [const char* ret]
scope { const char* current; }
@init {$fast_host::current=$ret=NULL;}
: (fast_hostname {$fast_host::current=(const char *)$fast_hostname.text->chars;}
| ipv4address {$fast_host::current=(const char *)$ipv4address.text->chars;}
/*| ipv4address {$fast_host::current=(const char *)$ipv4address.text->chars;} because cannot discriminate quickly betwenn 192.168.0.1 and 192.168.0.com*/
| ipv6reference {$fast_host::current=(const char *)$ipv6reference.ret;}) {$ret=$fast_host::current;};
fast_hostname: alpha ( alphanum | DASH | DOT )*;
fast_hostname: alphanum ( alphanum | DASH | DOT )*;
//*************************common tokens*******************************/
......
......@@ -39,7 +39,7 @@ static void testSIMPLEURI(void) {
static void testCOMPLEXURI(void) {
belle_sip_uri_t* L_tmp;
belle_sip_uri_t * L_uri = belle_sip_uri_parse("sip:toto@titi.com:5060;transport=tcp");
belle_sip_uri_t * L_uri = belle_sip_uri_parse("sip:toto@1titi.com:5060;transport=tcp");
char* l_raw_uri = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_uri));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_uri));
L_tmp = belle_sip_uri_parse(l_raw_uri);
......@@ -48,7 +48,7 @@ static void testCOMPLEXURI(void) {
belle_sip_free(l_raw_uri);
BC_ASSERT_STRING_EQUAL(belle_sip_uri_get_user(L_uri), "toto");
BC_ASSERT_EQUAL(belle_sip_uri_get_port(L_uri), 5060, int, "%d");
BC_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(L_uri), "titi.com");
BC_ASSERT_STRING_EQUAL(belle_sip_uri_get_host(L_uri), "1titi.com");
BC_ASSERT_STRING_EQUAL(belle_sip_uri_get_transport_param(L_uri), "tcp");
belle_sip_object_unref(BELLE_SIP_OBJECT(L_uri));
}
......
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