mirror of
https://github.com/vlang/v.git
synced 2025-09-08 06:41:58 -04:00
This commit is contained in:
parent
62872c677f
commit
abc9e06ed1
@ -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)!
|
||||
|
@ -122,3 +122,9 @@ fn test_parse() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn test_parse_slashes() {
|
||||
assert urllib.parse('/')!.str() == '/'
|
||||
assert urllib.parse('//')!.str() == '//'
|
||||
assert urllib.parse('///')!.str() == '///'
|
||||
}
|
||||
|
@ -339,3 +339,16 @@ ${config.content}'
|
||||
}
|
||||
return read.bytestr()
|
||||
}
|
||||
|
||||
// for issue 20476
|
||||
// phenomenon: parsing url error when querypath is `//`
|
||||
fn test_empty_querypath() {
|
||||
mut x := http.get('http://${localserver}') or { panic(err) }
|
||||
assert x.body == 'Welcome to VWeb'
|
||||
x = http.get('http://${localserver}/') or { panic(err) }
|
||||
assert x.body == 'Welcome to VWeb'
|
||||
x = http.get('http://${localserver}//') or { panic(err) }
|
||||
assert x.body == 'Welcome to VWeb'
|
||||
x = http.get('http://${localserver}///') or { panic(err) }
|
||||
assert x.body == 'Welcome to VWeb'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user