[vlc-commits] url: parse URL fragment

Rémi Denis-Courmont git at videolan.org
Fri Oct 26 18:03:01 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Oct 26 19:00:45 2018 +0300| [83f655528629f66df4815fffed44b2d11d061655] | committer: Rémi Denis-Courmont

url: parse URL fragment

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

 include/vlc_url.h | 1 +
 src/text/url.c    | 8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/vlc_url.h b/include/vlc_url.h
index e13b7a5abb..80ee599267 100644
--- a/include/vlc_url.h
+++ b/include/vlc_url.h
@@ -151,6 +151,7 @@ struct vlc_url_t
     unsigned i_port;
     char *psz_path;
     char *psz_option;
+    char *psz_fragment;
 
     char *psz_buffer; /* to be freed */
     char *psz_pathbuffer; /* to be freed */
diff --git a/src/text/url.c b/src/text/url.c
index 1b7d50fb61..6956ac8c7a 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -414,6 +414,7 @@ static int vlc_UrlParseInner(vlc_url_t *restrict url, const char *str)
     url->i_port = 0;
     url->psz_path = NULL;
     url->psz_option = NULL;
+    url->psz_fragment = NULL;
     url->psz_buffer = NULL;
     url->psz_pathbuffer = NULL;
 
@@ -447,12 +448,9 @@ static int vlc_UrlParseInner(vlc_url_t *restrict url, const char *str)
     next = strchr(cur, '#');
     if (next != NULL)
     {
-#if 0  /* TODO */
        *(next++) = '\0';
-       url->psz_fragment = next;
-#else
-       *next = '\0';
-#endif
+       if (vlc_uri_component_validate(next, "/?"))
+           url->psz_fragment = next;
     }
 
     /* Query parameters */



More information about the vlc-commits mailing list