From 8f7c2452dee8d8b72a6c0898ac90c44a4a7d9809 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Sat, 2 Oct 2010 21:57:58 +0000 Subject: [PATCH] applehttp: Allow the base url to be a local file name, too Originally committed as revision 25316 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/applehttp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 3aa7ed423..1252dc5a6 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -90,7 +90,7 @@ static void make_absolute_url(char *buf, int size, const char *base, const char *rel) { char *sep; - if (!base || strstr(rel, "://")) { + if (!base || strstr(rel, "://") || rel[0] == '/') { av_strlcpy(buf, rel, size); return; } @@ -99,13 +99,15 @@ static void make_absolute_url(char *buf, int size, const char *base, sep = strrchr(buf, '/'); if (sep) sep[1] = '\0'; - while (av_strstart(rel, "../", NULL)) { - if (sep) { + else + buf[0] = '\0'; + while (av_strstart(rel, "../", NULL) && sep) { sep[0] = '\0'; sep = strrchr(buf, '/'); if (sep) sep[1] = '\0'; - } + else + buf[0] = '\0'; rel += 3; } av_strlcat(buf, rel, size); -- 2.11.0