lib/rtsp/response.rb in rtsp-0.4.0 vs lib/rtsp/response.rb in rtsp-0.4.1

- old
+ new

@@ -66,14 +66,14 @@ # Pulls out the RTSP version, response code, and response message (AKA the # status line info) into instance variables. # # @param [String] line The String containing the status line info. def extract_status_line(line) - line =~ /RTSP\/(\d\.\d) (\d\d\d) ([^\r\n]+)/ - @rtsp_version = $1 - @code = $2.to_i - @message = $3 + line =~ /(RTSP|HTTP)\/(\d\.\d) (\d\d\d) ([^\r\n]+)/ + @rtsp_version = $2 + @code = $3.to_i + @message = $4 if @rtsp_version.nil? raise RTSP::Error, "Status line corrupted: #{line}" end end @@ -92,11 +92,11 @@ next end if line.include? "Session: " value = {} - line =~ /Session: (\d+)/ - value[:session_id] = $1.to_i + line =~ /Session: ([\w\\$\-\.\+]+)/ + value[:session_id] = $1 if line =~ /timeout=(.+)/ value[:timeout] = $1.to_i end