mirror of https://bitbucket.org/ausocean/av.git
More elegant switch in parseURL() for port logic.
This commit is contained in:
parent
3a70dc6ddc
commit
2697dcf515
|
@ -99,16 +99,15 @@ func parseURL(addr string) (protocol int32, host string, port uint16, app, playp
|
|||
}
|
||||
}
|
||||
|
||||
if port == 0 {
|
||||
switch {
|
||||
case (protocol & featureSSL) != 0:
|
||||
port = 433
|
||||
return errUnimplemented
|
||||
case (protocol & featureHTTP) != 0:
|
||||
port = 80
|
||||
default:
|
||||
port = 1935
|
||||
}
|
||||
switch {
|
||||
case port != 0:
|
||||
case (protocol & featureSSL) != 0:
|
||||
return protocol, host, port, app, playpath, errUnimplemented // port = 433
|
||||
case (protocol & featureHTTP) != 0:
|
||||
port = 80
|
||||
default:
|
||||
port = 1935
|
||||
}
|
||||
|
||||
return protocol, host, port, app, playpath, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue