This does not work for the following testcases, + lines are invalid: + test("/foo/bar", ".."); + test("/foo/bar/baz", "..");
- /foo/bar .. => / - /foo/bar/baz .. => /foo/ + /foo/bar .. => //foo/bar/baz + /foo/bar/baz .. => /foo//foo/bar/baz This one would be also nice if it worked: + test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/"); - http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/.. => http://server/foo/a/c/e../..f/.../other/ + http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/.. => http://server/foo/a/c/e../..f/.../other On Mon, Jul 27, 2020 at 3:08 PM Steven Liu <l...@chinaffmpeg.org> wrote: > Signed-off-by: Steven Liu <l...@chinaffmpeg.org> > --- > libavformat/tests/url.c | 14 ++++++++++++++ > tests/ref/fate/url | 12 ++++++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c > index 1d961a1b43..0de511caf9 100644 > --- a/libavformat/tests/url.c > +++ b/libavformat/tests/url.c > @@ -24,6 +24,8 @@ > static void test(const char *base, const char *rel) > { > char buf[200], buf2[200]; > + memset(buf, 0, 200); > + memset(buf2, 0, 200); > ff_make_absolute_url(buf, sizeof(buf), base, rel); > printf("%50s %-20s => %s\n", base, rel, buf); > if (base) { > @@ -66,7 +68,19 @@ int main(void) > test("http://server/foo/bar?param=value/with/slashes", "/baz"); > test("http://server/foo/bar?param&otherparam", "?someparam"); > test("http://server/foo/bar", "//other/url"); > + test("http://server/foo/bar", "../other/url"); > + test("http://server/foo/bar", "other/url"); > test("http://server/foo/bar", "../../../../../other/url"); > + test("http://server/foo/bar", "../../../../../other/url/test..mp3"); > + test("http://server/foo/bar", "../../../../../other/url/test.."); > + test("http://server/foo/bar", "../../../../../other/url/test/..."); > + test("http://server/foo/bar", > "../../../../../other/url/.../test/out"); > + test("http://server/foo/bar", > "../../../../../other/url/.../../test/out"); > + test("http://server/foo/bar", > "../../../../../other/url/.../..test/out"); > + test("http://server/foo/bar", "../../../../../other/url/.."); > + test("http://server/foo/bar", "../../../../../other/url/..mp3"); > + test("http://server/foo/bar", "../../../../../other/url/..test/mp3"); > + test("http://server/foo/bar", "../../../../../other/url/test../mp3"); > test("http://server/foo/bar", "/../../../../../other/url"); > test("http://server/foo/bar", "/test/../../../../../other/url"); > test("http://server/foo/bar", "/test/../../test/../../../other/url"); > diff --git a/tests/ref/fate/url b/tests/ref/fate/url > index 533ba2cb1e..35eee25f4a 100644 > --- a/tests/ref/fate/url > +++ b/tests/ref/fate/url > @@ -13,7 +13,19 @@ Testing ff_make_absolute_url: > http://server/foo/bar?param=value/with/slashes /baz > => http://server/baz > http://server/foo/bar?param&otherparam ?someparam > => http://server/foo/bar?someparam > http://server/foo/bar //other/url > => http://other/url > + http://server/foo/bar ../other/url => > http://server/other/url > + http://server/foo/bar other/url => > http://server/foo/other/url > http://server/foo/bar > ../../../../../other/url => http://server/other/url > + http://server/foo/bar > ../../../../../other/url/test..mp3 => http://server/other/url/test..mp3 > + http://server/foo/bar > ../../../../../other/url/test.. => http://server/other/url/test.. > + http://server/foo/bar > ../../../../../other/url/test/... => http://server/other/url/test/... > + http://server/foo/bar > ../../../../../other/url/.../test/out => > http://server/other/url/.../test/out > + http://server/foo/bar > ../../../../../other/url/.../../test/out => > http://server/other/url/test/out > + http://server/foo/bar > ../../../../../other/url/.../..test/out => > http://server/other/url/.../..test/out > + http://server/foo/bar > ../../../../../other/url/.. => http://server/other > + http://server/foo/bar > ../../../../../other/url/..mp3 => http://server/other/url/..mp3 > + http://server/foo/bar > ../../../../../other/url/..test/mp3 => http://server/other/url/..test/mp3 > + http://server/foo/bar > ../../../../../other/url/test../mp3 => http://server/other/url/test../mp3 > http://server/foo/bar > /../../../../../other/url => http://server/other/url > http://server/foo/bar > /test/../../../../../other/url => http://server/other/url > http://server/foo/bar > /test/../../test/../../../other/url => http://server/other/url > -- > 2.25.0 > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- Josef Zlomek _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".