mirror of https://bitbucket.org/ausocean/av.git
Move test for empty RTMP 'app' into parseURL().
This commit is contained in:
parent
a362d1d2ab
commit
efe40a6778
|
@ -121,9 +121,6 @@ func Dial(url string, timeout uint, log Log) (*Conn, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if c.link.app == "" {
|
||||
return nil, errInvalidURL
|
||||
}
|
||||
if c.link.port == 0 {
|
||||
switch {
|
||||
case (c.link.protocol & featureSSL) != 0:
|
||||
|
|
|
@ -41,7 +41,6 @@ import (
|
|||
)
|
||||
|
||||
// parseURL parses an RTMP URL (ok, technically it is lexing).
|
||||
//
|
||||
func parseURL(addr string) (protocol int32, host string, port uint16, app, playpath string, err error) {
|
||||
u, err := url.Parse(addr)
|
||||
if err != nil {
|
||||
|
@ -81,6 +80,9 @@ func parseURL(addr string) (protocol int32, host string, port uint16, app, playp
|
|||
}
|
||||
elems := strings.SplitN(u.Path[1:], "/", 3)
|
||||
app = elems[0]
|
||||
if app == "" {
|
||||
return protocol, host, port, app, playpath, errInvalidURL
|
||||
}
|
||||
playpath = elems[1]
|
||||
if len(elems) == 3 && len(elems[2]) != 0 {
|
||||
playpath = path.Join(elems[1:]...)
|
||||
|
|
Loading…
Reference in New Issue