Commit 670c2cec authored by Pekka Pessi's avatar Pekka Pessi

Using default sip and sips port in url comparisons if url has IP address

darcs-hash:20060223211305-65a35-e6841462ce31045d2cb326be61f4751351f67499.gz
parent 0b26b86f
......@@ -237,6 +237,7 @@ int test_sip(void)
"sips:user:pass@host:32;param=1"
"?From=foo@bar&To=bar@baz#unf";
int i, j;
url_t *a, *b;
BEGIN();
......@@ -381,6 +382,31 @@ int test_sip(void)
TEST_S(u->url_params, "isfocus");
TEST_1(!url_have_transport(u));
a = url_hdup(home, (void *)"sip:172.21.55.55:5060");
b = url_hdup(home, (void *)"sip:172.21.55.55");
TEST_1(a); TEST_1(b);
TEST_1(url_cmp(a, b) == 0);
a = url_hdup(home, (void *)"sips:172.21.55.55:5060");
b = url_hdup(home, (void *)"sips:172.21.55.55");
TEST_1(a); TEST_1(b);
TEST_1(url_cmp(a, b) != 0);
a = url_hdup(home, (void *)"sips:172.21.55.55:5061");
b = url_hdup(home, (void *)"sips:172.21.55.55");
TEST_1(a); TEST_1(b);
TEST_1(url_cmp(a, b) == 0);
a = url_hdup(home, (void *)"sip:my.domain:5060");
b = url_hdup(home, (void *)"sip:my.domain");
TEST_1(a); TEST_1(b);
TEST_1(url_cmp(a, b) != 0);
a = url_hdup(home, (void *)"sips:my.domain:5061");
b = url_hdup(home, (void *)"sips:my.domain");
TEST_1(a); TEST_1(b);
TEST_1(url_cmp(a, b) != 0);
su_home_deinit(home);
END();
......
......@@ -1394,8 +1394,12 @@ int url_cmp(url_t const *a, url_t const *b)
char const *a_port;
char const *b_port;
#define is_ip_address(s) ((s) && s[span_ip_address(s)] == '\0')
if (a->url_type != url_sip && a->url_type != url_sips)
a_port = b_port = url_port_default(a->url_type);
else if (is_ip_address(a->url_host))
a_port = b_port = url_port_default(a->url_type);
else
a_port = b_port = "";
......
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