[FFmpeg-cvslog] url: Don't treat slashes in query parameters as directory separators

Duncan Salerno git at videolan.org
Wed Oct 10 13:05:18 CEST 2012


ffmpeg | branch: master | Duncan Salerno <duncan.salerno at gmail.com> | Sat Oct  6 01:57:32 2012 +0300| [a6363e3d89e7a32078d28e7fb77bb5246e2cadee] | committer: Martin Storsjö

url: Don't treat slashes in query parameters as directory separators

Strip off query parameters from the original url before
applying the new relative path.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6363e3d89e7a32078d28e7fb77bb5246e2cadee
---

 libavformat/utils.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index bba5b2a..1fd0ba3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3389,7 +3389,7 @@ int ff_find_stream_index(AVFormatContext *s, int id)
 void ff_make_absolute_url(char *buf, int size, const char *base,
                           const char *rel)
 {
-    char *sep;
+    char *sep, *path_query;
     /* Absolute path, relative to the current server */
     if (base && strstr(base, "://") && rel[0] == '/') {
         if (base != buf)
@@ -3411,6 +3411,12 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
     }
     if (base != buf)
         av_strlcpy(buf, base, size);
+
+    /* Strip off any query string from base */
+    path_query = strchr(buf, '?');
+    if (path_query != NULL)
+        *path_query = '\0';
+
     /* Remove the file name from the base url */
     sep = strrchr(buf, '/');
     if (sep)



More information about the ffmpeg-cvslog mailing list