fix url parser from when I broke it trying to fix it, but now it's fixed.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3988 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-01-19 00:28:21 +00:00
parent ed0524c2fc
commit 5208bffe46

View File

@ -555,7 +555,7 @@ enum url_type_e url_get_type(char const *scheme, size_t len)
static static
int _url_d(url_t *url, char *s) int _url_d(url_t *url, char *s)
{ {
size_t n; size_t n, p;
char *s0, rest_c, *host; char *s0, rest_c, *host;
int net_path = 1; int net_path = 1;
@ -592,14 +592,23 @@ int _url_d(url_t *url, char *s)
if (url->url_type == url_sip || url->url_type == url_sips) { if (url->url_type == url_sip || url->url_type == url_sips) {
/* SIP URL may have /; in user part */ /* SIP URL may have /; in user part */
n = strcspn(s, "@"); /* Opaque part */ #if 1
if (n == strlen(s)) { n = strcspn(s, "@#"); /* Opaque part */
if ((strchr(s, '#'))) if ((p = strcspn(s, "#")) == n) {
n = 0; n = strcspn(s, "@");
} else { if (s[n] != '@')
if (strchr(s + n, '#')) n = 0;
n = 0; }
} #else
n = strcspn(s, "@");/* Opaque part */
if (n == strlen(s)) {
if ((strchr(s, '#')))
n = 0;
} else {
if (strchr(s + n, '#'))
n = 0;
}
#endif
n += strcspn(s + n, "/;?#"); n += strcspn(s + n, "/;?#");
} }
else if (url->url_type == url_wv) { else if (url->url_type == url_wv) {