summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorZhang Rui <bbcallen@gmail.com>2013-07-04 17:18:52 +0800
committerMartin Storsjö <martin@martin.st>2013-11-22 14:27:04 +0200
commit393d80cc278e2b2f5c9e7805db176e6f28335a33 (patch)
treec0513d35d65312a2d81d4619154720240b1b42fb /libavformat/http.c
parent76267ecc82e3018e1913a2483d5fc47d0949cbd8 (diff)
http: Support relative URL redirection
In RFC 2616, this was explicitly said to be an absolute URL, while in an upcoming draft [1] it is allowed to be relative as well. [1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-25#section-7.1.2 Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index a26ec2aea9..eb08dfe892 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -335,7 +335,10 @@ 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));
+ char redirected_location[MAX_URL_SIZE];
+ 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);