[vlc-commits] httplive: fix wrong url when computing relative uri.
Romain FLIEDEL
git at videolan.org
Tue Mar 4 12:57:34 CET 2014
vlc | branch: master | Romain FLIEDEL <romain.fliedel at gmail.com> | Mon Mar 3 11:04:36 2014 +0000| [12f3ef005ba6ec15eee7b94b4d74004ac44c55ec] | committer: Jean-Baptiste Kempf
httplive: fix wrong url when computing relative uri.
Remove extra slash when computing relative uri with an absolute path.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=12f3ef005ba6ec15eee7b94b4d74004ac44c55ec
---
modules/stream_filter/httplive.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index e763456..4445f6e 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -566,6 +566,7 @@ static int string_to_IV(char *string_hexa, uint8_t iv[AES_BLOCK_SIZE])
static char *relative_URI(const char *psz_url, const char *psz_path)
{
char *ret = NULL;
+ const char *fmt;
assert(psz_url != NULL && psz_path != NULL);
@@ -587,6 +588,7 @@ static char *relative_URI(const char *psz_url, const char *psz_path)
if (unlikely(slash == NULL))
goto end;
*slash = '\0';
+ fmt = "%s%s";
} else {
int levels = 0;
while(len >= 3 && !strncmp(psz_path, "../", 3)) {
@@ -600,9 +602,10 @@ static char *relative_URI(const char *psz_url, const char *psz_path)
goto end;
*slash = '\0';
} while (levels--);
+ fmt = "%s/%s";
}
- if (asprintf(&ret, "%s/%s", new_url, psz_path) < 0)
+ if (asprintf(&ret, fmt, new_url, psz_path) < 0)
ret = NULL;
end:
More information about the vlc-commits
mailing list