[FFmpeg-devel] [PATCH] Handle the following type of relative URL correctly:

Clément Bœsch ubitux at gmail.com
Tue Sep 25 01:06:28 CEST 2012


On Sun, Sep 23, 2012 at 09:12:54PM +0100, Duncan Salerno wrote:
> http://a/b + //c/d = http://c/d
> http://a/b?c + ?d = http://a/b?d
> http://a/b?c/d + /e = http://a/e

looks legit.

Just curious, what kind of specific issue did you expect?

> ---
>  libavformat/utils.c |   26 ++++++++++++++++++++++----
>  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 6603483..d4919c5 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4459,10 +4459,16 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
>              av_strlcpy(buf, base, size);
>          sep = strstr(buf, "://");
>          if (sep) {
> -            sep += 3;
> -            sep = strchr(sep, '/');
> -            if (sep)
> -                *sep = '\0';
> +            /* Take scheme from base url */
> +            if (rel[1] == '/')
> +                sep[1] = '\0';
> +            else {
> +                /* Take scheme and host from base url */
> +                sep += 3;
> +                sep = strchr(sep, '/');
> +                if (sep)
> +                    *sep = '\0';
> +            }
>          }
>          av_strlcat(buf, rel, size);
>          return;
> @@ -4474,6 +4480,18 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
>      }
>      if (base != buf)
>          av_strlcpy(buf, base, size);
> +    

trailing whitespace

> +    /* Stip off any query string from base */

strip?

> +    char *path_query = strchr(buf, '?');

you can't put a declaration here, some compilers will complain.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120925/3559a6f0/attachment.asc>


More information about the ffmpeg-devel mailing list