From 5208bffe46c721815c516afd86e90e405fe73747 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 19 Jan 2007 00:28:21 +0000 Subject: [PATCH] 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 --- libs/sofia-sip/libsofia-sip-ua/url/url.c | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/url/url.c b/libs/sofia-sip/libsofia-sip-ua/url/url.c index b0ec755871..61baa83d3b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/url/url.c +++ b/libs/sofia-sip/libsofia-sip-ua/url/url.c @@ -555,7 +555,7 @@ enum url_type_e url_get_type(char const *scheme, size_t len) static int _url_d(url_t *url, char *s) { - size_t n; + size_t n, p; char *s0, rest_c, *host; 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) { /* SIP URL may have /; in user part */ - n = strcspn(s, "@"); /* Opaque part */ - if (n == strlen(s)) { - if ((strchr(s, '#'))) - n = 0; - } else { - if (strchr(s + n, '#')) - n = 0; - } +#if 1 + n = strcspn(s, "@#"); /* Opaque part */ + if ((p = strcspn(s, "#")) == n) { + n = strcspn(s, "@"); + if (s[n] != '@') + 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, "/;?#"); } else if (url->url_type == url_wv) {