From: Timothy Allen via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: Timothy Allen <tim@treehouse.org.za> Subject: [FFmpeg-devel] [PATCH] Accept a colon in the path of a URI, instead of stripping preceding characters. Date: Tue, 20 May 2025 17:27:37 +0200 Message-ID: <aCyfaY8AFYU-mnni@treehouse.org.za> (raw) This commit closes trac ticket 10679. Signed-off-by: Timothy Allen <tim@treehouse.org.za> --- libavformat/tests/url.c | 8 +++++++- libavformat/url.c | 8 +++++++- tests/ref/fate/url | 7 ++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c index 8644a3e826..8bc3aab6be 100644 --- a/libavformat/tests/url.c +++ b/libavformat/tests/url.c @@ -148,9 +148,15 @@ int main(void) test("http://a/b", "//srv/shr/file"); test("http://a/b", "d:\\file"); test("http://a/b", "C:/file"); + test("http://a:b/c/d;p?q", "e"); // http://a:b/c/e + test("http://a:b/c/d;p?q", "e:f/g"); // http://a:d/c/e:f/g + test("http://u:w@a:p/b/c/d", "e"); // http://u:w@a/b/c/e + test("http://u:w@a:p/b/c/d", "/e"); // http://u:w@a/e + test("", "g:h"); // g:h + test("http://a/b/c/d;p?q", "g:h"); // http://a/b/c/g:h /* From https://tools.ietf.org/html/rfc3986#section-5.4 */ - test("http://a/b/c/d;p?q", "g:h"); // g:h + //test("http://a/b/c/d;p?q", "g:h"); // g:h test("http://a/b/c/d;p?q", "g"); // http://a/b/c/g test("http://a/b/c/d;p?q", "./g"); // http://a/b/c/g test("http://a/b/c/d;p?q", "g/"); // http://a/b/c/g/ diff --git a/libavformat/url.c b/libavformat/url.c index d5dd6a4666..abcd3d2366 100644 --- a/libavformat/url.c +++ b/libavformat/url.c @@ -100,7 +100,13 @@ 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 but not some RFC 3986 delimiters */ - if (*p == ':') + /* A colon can indicate a separator for the scheme + (https://host/), or the userinfo (user:pass@host/), or + the host/port (host:port). It can also be valid within the + path. To distinguish the scheme, require it to be followed + by a slash to indicate the scheme. + */ + if (*p == ':' && (p[1] == '/' || p[1] == '\\' || p[1] == '.')) cur = p + 1; /* authority */ diff --git a/tests/ref/fate/url b/tests/ref/fate/url index 8489d10968..229f9815f5 100644 --- a/tests/ref/fate/url +++ b/tests/ref/fate/url @@ -99,7 +99,12 @@ Testing ff_make_absolute_url: http://a/b //srv/shr/file => http://srv/shr/file http://a/b d:\file => d:\file http://a/b C:/file => C:/file - http://a/b/c/d;p?q g:h => g:h + http://a:b/c/d;p?q e => http://a:b/c/e + http://a:b/c/d;p?q e:f/g => http://a:b/c/e:f/g + http://u:w@a:p/b/c/d e => http://u:w@a:p/b/c/e + http://u:w@a:p/b/c/d /e => http://u:w@a:p/e + g:h => g:h + http://a/b/c/d;p?q g:h => http://a/b/c/g:h http://a/b/c/d;p?q g => http://a/b/c/g http://a/b/c/d;p?q ./g => http://a/b/c/g http://a/b/c/d;p?q g/ => http://a/b/c/g/ -- 2.43.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-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2025-05-20 15:27 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-05-20 15:27 Timothy Allen via ffmpeg-devel [this message] 2025-05-20 15:27 Timothy Allen via ffmpeg-devel 2025-05-20 19:49 ` Marton Balint 2025-05-20 20:03 ` softworkz . 2025-05-21 7:28 ` Timothy Allen via ffmpeg-devel 2025-05-21 18:56 ` softworkz . 2025-05-21 19:09 ` Timothy Allen via ffmpeg-devel 2025-05-21 19:25 ` softworkz . 2025-05-21 20:04 ` Timothy Allen via ffmpeg-devel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=aCyfaY8AFYU-mnni@treehouse.org.za \ --to=ffmpeg-devel@ffmpeg.org \ --cc=tim@treehouse.org.za \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git