From 0996649e51828499479893cda2654afcee700f7c Mon Sep 17 00:00:00 2001 From: shove70 <shove@163.com> Date: Fri, 12 Jan 2024 15:51:52 +0800 Subject: [PATCH] vweb: fix parsing url error when querypath is '//'(fix #20476) --- vlib/net/urllib/urllib.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vlib/net/urllib/urllib.v b/vlib/net/urllib/urllib.v index 90b27fec37cb0d..11aa93680a1fe6 100644 --- a/vlib/net/urllib/urllib.v +++ b/vlib/net/urllib/urllib.v @@ -512,7 +512,8 @@ fn parse_url(rawurl string, via_request bool) !URL { '')) } } - if ((url.scheme != '' || !via_request) && !rest.starts_with('///')) && rest.starts_with('//') { + if ((url.scheme != '' || !via_request) && !rest.starts_with('///')) && rest.starts_with('//') + && rest.len > 2 { authority, r := split(rest[2..], `/`, false) rest = r a := parse_authority(authority)!