do not treat generic bytes as strings into errors

This commit is contained in:
aler9
2022-01-23 12:39:21 +01:00
parent f6a86b8789
commit 8ef623f56d
4 changed files with 9 additions and 9 deletions

View File

@@ -139,10 +139,10 @@ func (res *Response) Read(rb *bufio.Reader) error {
if err != nil {
return err
}
proto := string(byts[:len(byts)-1])
proto := byts[:len(byts)-1]
if proto != rtspProtocol10 {
return fmt.Errorf("expected '%s', got '%s'", rtspProtocol10, proto)
if string(proto) != rtspProtocol10 {
return fmt.Errorf("expected '%s', got %v", rtspProtocol10, proto)
}
byts, err = readBytesLimited(rb, ' ', 4)