[FFmpeg-cvslog] avformat/http: support relative url redirection

Zhang Rui git at videolan.org
Thu Jul 4 16:23:28 CEST 2013


ffmpeg | branch: master | Zhang Rui <bbcallen at gmail.com> | Thu Jul  4 17:18:52 2013 +0800| [4a4c93cb3f2f564263f4b20446a7d500772e0d40] | committer: Michael Niedermayer

avformat/http: support relative url redirection

see also http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-17#section-9.5

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/http.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index be82352..0c26cd5 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -298,6 +298,7 @@ static int process_line(URLContext *h, char *line, int line_count,
 {
     HTTPContext *s = h->priv_data;
     char *tag, *p, *end;
+    char redirected_location[MAX_URL_SIZE];
 
     /* end of header */
     if (line[0] == '\0') {
@@ -337,7 +338,8 @@ static int process_line(URLContext *h, char *line, int line_count,
         while (av_isspace(*p))
             p++;
         if (!av_strcasecmp(tag, "Location")) {
-            av_strlcpy(s->location, p, sizeof(s->location));
+            ff_make_absolute_url(redirected_location, sizeof(redirected_location), s->location, p);
+            av_strlcpy(s->location, redirected_location, sizeof(s->location));
             *new_location = 1;
         } else if (!av_strcasecmp (tag, "Content-Length") && s->filesize == -1) {
             s->filesize = strtoll(p, NULL, 10);



More information about the ffmpeg-cvslog mailing list