protocol/rtsp: fixed read response bug

This commit is contained in:
Saxon 2019-04-26 19:51:00 +09:30
parent 999eab21ab
commit f2b941394b
1 changed files with 4 additions and 4 deletions

View File

@ -166,15 +166,15 @@ func ReadResponse(r io.Reader) (*Response, error) {
return nil, err return nil, err
} }
if len(s) < minResponse {
return nil, errSmallResponse
}
// Check that it was terminated by CRLF. // Check that it was terminated by CRLF.
if []byte(s)[len(s)-2] != '\r' { if []byte(s)[len(s)-2] != '\r' {
return nil, errors.New("line not terminated by CRLF") return nil, errors.New("line not terminated by CRLF")
} }
if len(s) < minResponse {
return nil, errSmallResponse
}
// Split first line. // Split first line.
s1 := strings.SplitN(s, " ", 3) s1 := strings.SplitN(s, " ", 3)