From patchwork Sat Oct 17 14:46:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6JSh5piK5Yed?= X-Patchwork-Id: 23037 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 948A944B94A for ; Sat, 17 Oct 2020 17:54:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6A05468B8C3; Sat, 17 Oct 2020 17:54:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CD5268B8C3 for ; Sat, 17 Oct 2020 17:54:32 +0300 (EEST) Received: by mail-oi1-f194.google.com with SMTP id 16so6266548oix.9 for ; Sat, 17 Oct 2020 07:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Afko3nrC/dDPZxDFK/iQC31wY4J5cgMhtxrCccOoI/Y=; b=dNRUFaPtoNu8UilA38CQwzskU22tiFPRx0XGOWEjPtHCUtY1DPFNwSKMfxNMN9jvVu QpzKqU8kc0+X5cKaSg5XDDhfbqMhIpYoyb1fYk0tIcD87/1q0r+bu+nczgXfoZi12ihU mbeJ4opqFRJYsKXJkQtZP9ETV6AItYRCpgsECQpVXO5WoGznGfDTXytm+FuaBN2s4R+6 YHBuCQpFgLrM5iYNKQe6Lpt/kNZfG3gG+RwwwXlvSZfNf9yJ7FS3FS2WEKo2tP5MhmlL ukRPEs4VYco4tAkAzTte5Ms54cRg0dPGqbdwYGm3GEDXASPSpRVZ7msVnyeMGNzFu3t+ 4ghA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Afko3nrC/dDPZxDFK/iQC31wY4J5cgMhtxrCccOoI/Y=; b=Qs3s0/1ChLQnzbbIwGIClYvjdCRnIW+qFoU0XisNQTUKMu4EBdITgoaC3QFDfAtIIS 7S3ie/Ka7tfMfNnVeWNoOK3hOtdR5rJ2QHF0vUTzMejpD7cfvko8FpA0OJoiRVzMym93 JaJW0RvYdQ/NdYk6iiOlkh8AgM22du68e4PtGa+rpxFD2fXgwfvDS+NgNeKxc9os+C2R O1RbO6Ko+2pm4MKt74aLMiJkoM2zxeQL+qInaIVWq+bh3MVdiZdpRo8H26Pgo8t0/UUU 3gchJPi7McAPAoClZTq3Y+kWesP0/c/bwF4c33uEfhVZfYDQ6It8T1B9ojCntSuMzR73 KADw== X-Gm-Message-State: AOAM530aFbLIQ/uUBfevcssmw0OYJHBbG8/LhLefdtGurONhsP+klXuu CuS7dkdA5MR683QXYj0+INDDU8Y7Dowcqg== X-Google-Smtp-Source: ABdhPJyMBoF7mxxUYCOrsOJZuNBDig8ebikPsCUvWSBE2tXWvPL5uKYQhG7oZu95QzBWsMq7IyWXHg== X-Received: by 2002:a17:90b:4c8c:: with SMTP id my12mr8780772pjb.129.1602946002021; Sat, 17 Oct 2020 07:46:42 -0700 (PDT) Received: from localhost.localdomain ([113.65.228.192]) by smtp.gmail.com with ESMTPSA id k9sm6160123pgt.72.2020.10.17.07.46.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Oct 2020 07:46:41 -0700 (PDT) From: caihaoning83@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 17 Oct 2020 22:46:04 +0800 Message-Id: <20201017144604.43394-1-caihaoning83@gmail.com> X-Mailer: git-send-email 2.24.1 (Apple Git-126) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] fix relative URLs contains "://" or "#" X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: "ruiquan.crq" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: "ruiquan.crq" Signed-off-by: ruiquan.crq --- 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