This commit is contained in:
GyeongHo Kim 2025-01-21 16:05:03 +09:00 committed by GitHub
commit a52bd09c96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,6 +14,7 @@ import (
"log" "log"
"net" "net"
"net/url" "net/url"
"regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -661,6 +662,11 @@ func (client *RTSPClient) parseURL(rawURL string) error {
} }
username := l.User.Username() username := l.User.Username()
password, _ := l.User.Password() password, _ := l.User.Password()
pattern := `[ !#$%&'()*+,/:;=?@\[\]]`
re := regexp.MustCompile(pattern)
if re.MatchString(username) || re.MatchString(password) {
return errors.New("please url encode username and password")
}
l.User = nil l.User = nil
if l.Port() == "" { if l.Port() == "" {
l.Host = fmt.Sprintf("%s:%s", l.Host, "554") l.Host = fmt.Sprintf("%s:%s", l.Host, "554")