fix authorization failed on no-port url

pull/132/head
macbookpro 2018-12-25 16:39:27 +08:00
parent 36703199e1
commit c67b575e0b
1 changed files with 4 additions and 0 deletions

View File

@ -116,6 +116,9 @@ func digestAuth(authLine string, method string, URL string) (string, error) {
username := l.User.Username()
password, _ := l.User.Password()
l.User = nil
if l.Port() == "" {
l.Host = fmt.Sprintf("%s:%s", l.Host, "554")
}
md5UserRealmPwd := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", username, realm, password))))
md5MethodURL := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s", method, l.String()))))
@ -240,6 +243,7 @@ func (client *RTSPClient) Start(timeout time.Duration) error {
if len(Authorization) > 0 {
headers := make(map[string]string)
headers["Authorization"] = Authorization
headers["Accept"] = "application/sdp"
resp, err = client.Request("DESCRIBE", headers)
}
if err != nil {