Skip to content

Commit 88feb47

Browse files
committed
fix merge
1 parent 7c54c5a commit 88feb47

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

vlib/net/util.v

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,24 @@ pub fn split_address(addr string) !(string, u16) {
2121
port := addr.all_after_last(']:').int()
2222
p := validate_port(port)!
2323
return address, p
24-
} else if _ := addr.index(':') {
25-
// ipv6 ::1
26-
if addr.all_before_last(':').trim(':') == '' {
24+
} else if _ := addr.index('::') {
25+
// ipv6 host only ::1
26+
if addr.all_before_last('::') == '' {
2727
return addr, 0
2828
} else {
29-
// ip:port
29+
// addr:port
3030
address := addr.all_before_last(':')
3131
port := addr.all_after_last(':').int()
3232
p := validate_port(port)!
3333
return address, p
3434
}
35+
} else if _ := addr.index(':') {
36+
// addr:port
37+
address := addr.all_before_last(':')
38+
p := validate_port(addr.all_after_last(':').int())!
39+
return address, p
3540
} else {
3641
// addr only
37-
address := addr.all_before_last(':')
38-
return address, 0
42+
return addr, 0
3943
}
4044
}

0 commit comments

Comments
 (0)