Tue Feb 10 16:55:11 CST 2009 Pekka Pessi <first.last@nokia.com>

* url: accept empty port number in URLs



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11934 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-02-12 21:01:01 +00:00
parent 9b95c86dfe
commit 695cae05bf
3 changed files with 13 additions and 3 deletions

View File

@ -1 +1 @@
Wed Feb 11 11:41:31 CST 2009
Thu Feb 12 15:00:54 CST 2009

View File

@ -341,6 +341,9 @@ int test_sip(void)
u = url_hdup(home, (url_t*)"SIP:test@127.0.0.1:55"); TEST_1(u);
TEST(u->url_type, url_sip);
u = url_hdup(home, (url_t*)"SIP:test@127.0.0.1:"); TEST_1(u);
TEST(u->url_type, url_sip);
TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1::55"), NULL);
TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1:55:"), NULL);
TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1:sip"), NULL);

View File

@ -713,8 +713,15 @@ int _url_d(url_t *url, char *s)
while (*port >= '0' && *port <= '9')
port++;
if (port != url->url_port ? port[0] != '\0'
: (port[0] != '*' || port[1] != '\0'))
if (port != url->url_port) {
if (port[0] != '\0')
return -1;
}
else if (port[0] == '\0')
/* empty string */;
else if (port[0] == '*' && port[1] == '\0')
/* wildcard */;
else
return -1;
}
host[n] = 0;