]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix url parser from when I broke it trying to fix it, but now it's fixed.
authorMichael Jerris <mike@jerris.com>
Fri, 19 Jan 2007 00:28:21 +0000 (00:28 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 19 Jan 2007 00:28:21 +0000 (00:28 +0000)
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

index b0ec75587133dcc6b2679c673d32c7e246d18902..61baa83d3b510a55de1d0a9b5b3f96a3d557ebf6 100644 (file)
@@ -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\r
+       n = strcspn(s, "@#");   /* Opaque part */\r
+       if ((p = strcspn(s, "#")) == n) {\r
+         n = strcspn(s, "@");\r
+      if (s[n] != '@')\r
+        n = 0;\r
+       }\r
+#else\r
+    n = strcspn(s, "@");/* Opaque part */\r
+    if (n == strlen(s)) {\r
+        if ((strchr(s, '#')))\r
+            n = 0;\r
+    } else {\r
+        if (strchr(s + n, '#'))\r
+            n = 0;\r
+    }\r
+#endif\r
     n += strcspn(s + n, "/;?#");
   }
   else if (url->url_type == url_wv) {