mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net.urllib: workaround an autofree bug for if cond && opt() {
This commit is contained in:
parent
4ffe3d83b8
commit
ef18fb837c
@ -997,10 +997,12 @@ fn split_host_port(hostport string) (string, string) {
|
|||||||
mut host := hostport
|
mut host := hostport
|
||||||
mut port := ''
|
mut port := ''
|
||||||
colon := host.last_index_byte(`:`)
|
colon := host.last_index_byte(`:`)
|
||||||
if colon != -1 && valid_optional_port(host[colon..]) {
|
if colon != -1 {
|
||||||
|
if valid_optional_port(host[colon..]) {
|
||||||
port = host[colon + 1..]
|
port = host[colon + 1..]
|
||||||
host = host[..colon]
|
host = host[..colon]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if host.starts_with('[') && host.ends_with(']') {
|
if host.starts_with('[') && host.ends_with(']') {
|
||||||
host = host[1..host.len - 1]
|
host = host[1..host.len - 1]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user