ws: obtain port when not specified (#5922)
parent
0d8ebf5845
commit
635c99e2ed
|
@ -107,10 +107,19 @@ fn (ws &Client) parse_uri() &Uri {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
v := u.request_uri().split('?')
|
v := u.request_uri().split('?')
|
||||||
|
mut port := u.port()
|
||||||
|
//Check if port is empty and check protocol to get the port, secure by default
|
||||||
|
if port == '' {
|
||||||
|
if ws.uri.contains('://') {
|
||||||
|
port = if ws.uri.split('://')[0] == 'ws' { '80' } else { '443' }
|
||||||
|
} else {
|
||||||
|
port = '443'
|
||||||
|
}
|
||||||
|
}
|
||||||
querystring := if v.len > 1 { '?' + v[1] } else { '' }
|
querystring := if v.len > 1 { '?' + v[1] } else { '' }
|
||||||
return &Uri{
|
return &Uri{
|
||||||
hostname: u.hostname()
|
hostname: u.hostname()
|
||||||
port: u.port()
|
port: port
|
||||||
resource: v[0]
|
resource: v[0]
|
||||||
querystring: querystring
|
querystring: querystring
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue