mirror of https://bitbucket.org/ausocean/av.git
protocol/rtsp: fixed read response bug
This commit is contained in:
parent
999eab21ab
commit
f2b941394b
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue