summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorZhang Rui <bbcallen@gmail.com>2013-07-04 17:18:52 +0800
committerMichael Niedermayer <michaelni@gmx.at>2013-07-04 16:16:03 +0200
commit4a4c93cb3f2f564263f4b20446a7d500772e0d40 (patch)
tree3f3e981169d117e334bf9469194a0387ae89472f /libavformat/http.c
parent253e155251ece10caf152a83846e74da350b6cd7 (diff)
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@gmx.at>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index be82352b9f..0c26cd5eab 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);