]> git.sesse.net Git - ffmpeg/commitdiff
applehttp: Handle absolute paths relative to the current server
authorMartin Storsjö <martin@martin.st>
Fri, 4 Feb 2011 09:09:48 +0000 (11:09 +0200)
committerRonald S. Bultje <rsbultje@gmail.com>
Fri, 4 Feb 2011 17:23:04 +0000 (12:23 -0500)
This fixes roundup issue 2583.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
libavformat/applehttp.c

index 50466faf821e5bdcb3097821d937a15df03bc17d..37a040cf34f60494b7dd0832c9fa10db982eab23 100644 (file)
@@ -90,6 +90,20 @@ static void make_absolute_url(char *buf, int size, const char *base,
                               const char *rel)
 {
     char *sep;
+    /* Absolute path, relative to the current server */
+    if (base && strstr(base, "://") && rel[0] == '/') {
+        if (base != buf)
+            av_strlcpy(buf, base, size);
+        sep = strstr(buf, "://");
+        if (sep) {
+            sep += 3;
+            sep = strchr(sep, '/');
+            if (sep)
+                *sep = '\0';
+        }
+        av_strlcat(buf, rel, size);
+        return;
+    }
     /* If rel actually is an absolute url, just copy it */
     if (!base || strstr(rel, "://") || rel[0] == '/') {
         av_strlcpy(buf, rel, size);