diff --git a/protocol/rtsp/rtsp.go b/protocol/rtsp/rtsp.go index 1bcd55b1..fda744d8 100644 --- a/protocol/rtsp/rtsp.go +++ b/protocol/rtsp/rtsp.go @@ -100,7 +100,7 @@ type Response struct { ProtoMinor int StatusCode int Status string - ContentLength int64 + ContentLength int Header http.Header Body io.ReadCloser } @@ -184,7 +184,10 @@ func ReadResponse(r io.Reader) (*Response, error) { } // Get the content length from the header. - resp.ContentLength, _ = strconv.ParseInt(resp.Header.Get("Content-Length"), 10, 64) + resp.ContentLength, err = strconv.Atoi(resp.Header.Get("Content-Length")) + if err != nil { + return nil, err + } resp.Body = closer{b, r} return resp, nil