File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -21,20 +21,24 @@ pub fn split_address(addr string) !(string, u16) {
21
21
port := addr.all_after_last (']:' ).int ()
22
22
p := validate_port (port)!
23
23
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 ('::' ) == '' {
27
27
return addr, 0
28
28
} else {
29
- // ip :port
29
+ // addr :port
30
30
address := addr.all_before_last (':' )
31
31
port := addr.all_after_last (':' ).int ()
32
32
p := validate_port (port)!
33
33
return address, p
34
34
}
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
35
40
} else {
36
41
// addr only
37
- address := addr.all_before_last (':' )
38
- return address, 0
42
+ return addr, 0
39
43
}
40
44
}
You can’t perform that action at this time.
0 commit comments