summaryrefslogtreecommitdiff
path: root/libavformat/applehttp.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-02-04 11:09:48 +0200
committerRonald S. Bultje <rsbultje@gmail.com>2011-02-04 12:23:04 -0500
commit185a155e5701cfaa0281bf91a5a140d498aa0a7f (patch)
tree31a93ed3a154b314d2f81ce9d42c82cd143b7af4 /libavformat/applehttp.c
parent5306bf41a619cb757ef0e0092ea4f6bc1087e687 (diff)
applehttp: Handle absolute paths relative to the current server
This fixes roundup issue 2583. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/applehttp.c')
-rw-r--r--libavformat/applehttp.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index 50466faf82..37a040cf34 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -90,6 +90,20 @@ static void make_absolute_url(char *buf, int size, const char *base,
const char *rel)
{
char *sep;
+ /* Absolute path, relative to the current server */
+ if (base && strstr(base, "://") && rel[0] == '/') {
+ if (base != buf)
+ av_strlcpy(buf, base, size);
+ sep = strstr(buf, "://");
+ if (sep) {
+ sep += 3;
+ sep = strchr(sep, '/');
+ if (sep)
+ *sep = '\0';
+ }
+ av_strlcat(buf, rel, size);
+ return;
+ }
/* If rel actually is an absolute url, just copy it */
if (!base || strstr(rel, "://") || rel[0] == '/') {
av_strlcpy(buf, rel, size);