[vlc-commits] url: discard fragment if present
Rémi Denis-Courmont
git at videolan.org
Tue Aug 2 21:05:32 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 2 22:00:05 2016 +0300| [8a03ab184e622b002174e5a3eacfa8c51cedd952] | committer: Rémi Denis-Courmont
url: discard fragment if present
If query string is absent and the fragment present, the path is
followed a hash sign. We need to discard to avoid invalid path.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a03ab184e622b002174e5a3eacfa8c51cedd952
---
src/text/url.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/text/url.c b/src/text/url.c
index 88a4740..dbe7efb 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -400,12 +400,24 @@ void vlc_UrlParse (vlc_url_t *restrict url, const char *str)
cur = next;
}
+ /* Fragment */
+ next = strchr(cur, '#');
+ if (next != NULL)
+ {
+#if 0 /* TODO */
+ *(next++) = '\0';
+ url->psz_fragment = next;
+#else
+ *next = '\0';
+#endif
+ }
+
/* Query parameters */
- char *query = strchr (cur, '?');
- if (query != NULL)
+ next = strchr(cur, '?');
+ if (next != NULL)
{
- *(query++) = '\0';
- url->psz_option = query;
+ *(next++) = '\0';
+ url->psz_option = next;
}
/* Authority */
More information about the vlc-commits
mailing list