[vlc-commits] url: strip request parameters in make_path()

Rémi Denis-Courmont git at videolan.org
Thu Aug 27 20:38:20 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 27 19:10:18 2015 +0300| [0084accbd14cec985eb5471cef7e68ebe0729aaf] | committer: Rémi Denis-Courmont

url: strip request parameters in make_path()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0084accbd14cec985eb5471cef7e68ebe0729aaf
---

 src/text/url.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/text/url.c b/src/text/url.c
index f2d7fb9..fe6f420 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -271,12 +271,9 @@ char *make_path (const char *url)
     size_t schemelen = ((end != NULL) ? end : path) - url;
     path += 3; /* skip "://" */
 
-    /* Remove HTML anchor if present */
-    end = strchr (path, '#');
-    if (end)
-        path = strndup (path, end - path);
-    else
-        path = strdup (path);
+    /* Remove request parameters and/or HTML anchor if present */
+    end = path + strcspn (path, "?#");
+    path = strndup (path, end - path);
     if (unlikely(path == NULL))
         return NULL; /* boom! */
 



More information about the vlc-commits mailing list