net.urllib: workaround an autofree bug for `if cond && opt() {`
parent
4ffe3d83b8
commit
ef18fb837c
|
@ -997,9 +997,11 @@ 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 {
|
||||||
port = host[colon + 1..]
|
if valid_optional_port(host[colon..]) {
|
||||||
host = host[..colon]
|
port = host[colon + 1..]
|
||||||
|
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