diff mbox series

[FFmpeg-devel,v3] lavf/url: fix rel path’s query string contains :/

Message ID 20201017151714.44216-1-caihaoning83@gmail.com
State New
Headers show
Series [FFmpeg-devel,v3] lavf/url: fix rel path’s query string contains :/
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

蔡昊凝 Oct. 17, 2020, 3:17 p.m. UTC
From: "ruiquan.crq" <caihaoning83@gmail.com>

Signed-off-by: ruiquan.crq <caihaoning83@gmail.com>
---
 libavformat/tests/url.c | 2 ++
 libavformat/url.c       | 2 +-
 tests/ref/fate/url      | 8 ++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

Comments

蔡昊凝 Oct. 23, 2020, 2:59 a.m. UTC | #1
<caihaoning83@gmail.com> 于2020年10月17日周六 下午11:17写道:

> From: "ruiquan.crq" <caihaoning83@gmail.com>
>
> Signed-off-by: ruiquan.crq <caihaoning83@gmail.com>
> ---
>  libavformat/tests/url.c | 2 ++
>  libavformat/url.c       | 2 +-
>  tests/ref/fate/url      | 8 ++++++++
>  3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c
> index 2440ae08bc..2eb597bb5e 100644
> --- a/libavformat/tests/url.c
> +++ b/libavformat/tests/url.c
> @@ -90,6 +90,8 @@ int main(void)
>      test_decompose("http://[::1]/dev/null");
>      test_decompose("http://[::1]:8080/dev/null");
>      test_decompose("//ffmpeg/dev/null");
> +    test_decompose("test?url=http://server/path");
> +    test_decompose("dummy.mp4#t=0:02:00,121.5");
>
>      printf("Testing ff_make_absolute_url:\n");
>      test(NULL, "baz");
> diff --git a/libavformat/url.c b/libavformat/url.c
> index 3c858f0257..6db4b4e1ae 100644
> --- a/libavformat/url.c
> +++ b/libavformat/url.c
> @@ -97,7 +97,7 @@ int ff_url_decompose(URLComponents *uc, const char *url,
> const char *end)
>
>      /* scheme */
>      uc->scheme = cur;
> -    p = find_delim(":/", cur, end); /* lavf "schemes" can contain options
> */
> +    p = find_delim(":/?#", cur, end); /* lavf "schemes" can contain
> options but not some RFC 3986 delimiters */
>      if (*p == ':')
>          cur = p + 1;
>
> diff --git a/tests/ref/fate/url b/tests/ref/fate/url
> index 7e6395c47b..08e80def7d 100644
> --- a/tests/ref/fate/url
> +++ b/tests/ref/fate/url
> @@ -43,6 +43,14 @@ http://[::1]:8080/dev/null =>
>    host: ffmpeg
>    path: /dev/null
>
> +test?url=http://server/path =>
> +  path: test
> +  query: ?url=http://server/path
> +
> +dummy.mp4#t=0:02:00,121.5 =>
> +  path: dummy.mp4
> +  fragment: #t=0:02:00,121.5
> +
>  Testing ff_make_absolute_url:
>                                              (null) baz
> => baz
>                                            /foo/bar baz
> => /foo/baz
> --
> 2.24.1 (Apple Git-126)
>
>
What is the status of this patch?
I am not sure about the process of submitting patch for the first time.
Marton Balint Oct. 25, 2020, 12:11 p.m. UTC | #2
On Fri, 23 Oct 2020, 蔡昊凝 wrote:

> <caihaoning83@gmail.com> 于2020年10月17日周六 下午11:17写道:
>
>> From: "ruiquan.crq" <caihaoning83@gmail.com>
>>
>> Signed-off-by: ruiquan.crq <caihaoning83@gmail.com>
>> ---
>>  libavformat/tests/url.c | 2 ++
>>  libavformat/url.c       | 2 +-
>>  tests/ref/fate/url      | 8 ++++++++
>>  3 files changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c
>> index 2440ae08bc..2eb597bb5e 100644
>> --- a/libavformat/tests/url.c
>> +++ b/libavformat/tests/url.c
>> @@ -90,6 +90,8 @@ int main(void)
>>      test_decompose("http://[::1]/dev/null");
>>      test_decompose("http://[::1]:8080/dev/null");
>>      test_decompose("//ffmpeg/dev/null");
>> +    test_decompose("test?url=http://server/path");
>> +    test_decompose("dummy.mp4#t=0:02:00,121.5");
>>
>>      printf("Testing ff_make_absolute_url:\n");
>>      test(NULL, "baz");
>> diff --git a/libavformat/url.c b/libavformat/url.c
>> index 3c858f0257..6db4b4e1ae 100644
>> --- a/libavformat/url.c
>> +++ b/libavformat/url.c
>> @@ -97,7 +97,7 @@ int ff_url_decompose(URLComponents *uc, const char *url,
>> const char *end)
>>
>>      /* scheme */
>>      uc->scheme = cur;
>> -    p = find_delim(":/", cur, end); /* lavf "schemes" can contain options
>> */
>> +    p = find_delim(":/?#", cur, end); /* lavf "schemes" can contain
>> options but not some RFC 3986 delimiters */
>>      if (*p == ':')
>>          cur = p + 1;
>>
>> diff --git a/tests/ref/fate/url b/tests/ref/fate/url
>> index 7e6395c47b..08e80def7d 100644
>> --- a/tests/ref/fate/url
>> +++ b/tests/ref/fate/url
>> @@ -43,6 +43,14 @@ http://[::1]:8080/dev/null =>
>>    host: ffmpeg
>>    path: /dev/null
>>
>> +test?url=http://server/path =>
>> +  path: test
>> +  query: ?url=http://server/path
>> +
>> +dummy.mp4#t=0:02:00,121.5 =>
>> +  path: dummy.mp4
>> +  fragment: #t=0:02:00,121.5
>> +
>>  Testing ff_make_absolute_url:
>>                                              (null) baz
>> => baz
>>                                            /foo/bar baz
>> => /foo/baz
>> --
>> 2.24.1 (Apple Git-126)
>>
>>
> What is the status of this patch?

Looks good to me, I will apply it in 1-2 days.

Thanks,
Marton
diff mbox series

Patch

diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c
index 2440ae08bc..2eb597bb5e 100644
--- a/libavformat/tests/url.c
+++ b/libavformat/tests/url.c
@@ -90,6 +90,8 @@  int main(void)
     test_decompose("http://[::1]/dev/null");
     test_decompose("http://[::1]:8080/dev/null");
     test_decompose("//ffmpeg/dev/null");
+    test_decompose("test?url=http://server/path");
+    test_decompose("dummy.mp4#t=0:02:00,121.5");
 
     printf("Testing ff_make_absolute_url:\n");
     test(NULL, "baz");
diff --git a/libavformat/url.c b/libavformat/url.c
index 3c858f0257..6db4b4e1ae 100644
--- a/libavformat/url.c
+++ b/libavformat/url.c
@@ -97,7 +97,7 @@  int ff_url_decompose(URLComponents *uc, const char *url, const char *end)
 
     /* scheme */
     uc->scheme = cur;
-    p = find_delim(":/", cur, end); /* lavf "schemes" can contain options */
+    p = find_delim(":/?#", cur, end); /* lavf "schemes" can contain options but not some RFC 3986 delimiters */
     if (*p == ':')
         cur = p + 1;
 
diff --git a/tests/ref/fate/url b/tests/ref/fate/url
index 7e6395c47b..08e80def7d 100644
--- a/tests/ref/fate/url
+++ b/tests/ref/fate/url
@@ -43,6 +43,14 @@  http://[::1]:8080/dev/null =>
   host: ffmpeg
   path: /dev/null
 
+test?url=http://server/path =>
+  path: test
+  query: ?url=http://server/path
+
+dummy.mp4#t=0:02:00,121.5 =>
+  path: dummy.mp4
+  fragment: #t=0:02:00,121.5
+
 Testing ff_make_absolute_url:
                                             (null) baz                  => baz
                                           /foo/bar baz                  => /foo/baz