diff --git a/protocol/rtsp/rtsp.go b/protocol/rtsp/rtsp.go index c12cf707..501ae5be 100644 --- a/protocol/rtsp/rtsp.go +++ b/protocol/rtsp/rtsp.go @@ -41,7 +41,7 @@ import ( ) // Minimum response size to be considered valid in bytes. -const minResponse = 2 +const minResponse = 12 var errSmallResponse = errors.New("response too small") @@ -132,12 +132,8 @@ func ReadResponse(r io.Reader) (*Response, error) { } s := scanner.Text() - if len(s) < minResponse { - return nil, errSmallResponse - } - - if s[:5] != "RTSP/" { - return nil, errors.New("not a valid RTSP response") + if s[:5] != "RTSP/" || len(s) < minResponse { + return nil, errors.New("response not valid") } resp.Proto = "RTSP"