[FFmpeg-devel] [PATCH] applehttp: Handle absolute paths relative to the current server
Ronald S. Bultje
rsbultje
Fri Feb 4 18:24:11 CET 2011
Hi,
On Fri, Feb 4, 2011 at 4:09 AM, Martin Storsj? <martin at martin.st> wrote:
> This fixes roundup issue 2583.
> ---
> ?libavformat/applehttp.c | ? 14 ++++++++++++++
> ?1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
> index 50466fa..37a040c 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);
> --
> 1.7.3.1
Applied.
The lines here appear very similar, maybe they should be generalized
into a subfunction of some sort? (Maybe not possible/necessary, just
from a quick look at it.)
Ronald
More information about the ffmpeg-devel
mailing list