[FFmpeg-cvslog] url: Handle relative urls starting with two slashes

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


ffmpeg | branch: master | Duncan Salerno <duncan.salerno at gmail.com> | Sat Oct  6 02:02:18 2012 +0300| [33893e6abcdca865c06c64547be56070c64aa590] | committer: Martin Storsjö

url: Handle relative urls starting with two slashes

This is defined by RFC 3986 section 5.4.1 to be handled this way.

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

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

 libavformat/utils.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9d0049a..ca52469 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3396,10 +3396,16 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
             av_strlcpy(buf, base, size);
         sep = strstr(buf, "://");
         if (sep) {
-            sep += 3;
-            sep = strchr(sep, '/');
-            if (sep)
-                *sep = '\0';
+            /* Take scheme from base url */
+            if (rel[1] == '/') {
+                sep[1] = '\0';
+            } else {
+                /* Take scheme and host from base url */
+                sep += 3;
+                sep = strchr(sep, '/');
+                if (sep)
+                    *sep = '\0';
+            }
         }
         av_strlcat(buf, rel, size);
         return;



More information about the ffmpeg-cvslog mailing list