Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

changed session id from an integer to a string #16

Merged
merged 2 commits into from
Nov 12, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rtsp/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def request message
#
# @raise [RTSP::Error] Raises if @session isn't set.
def ensure_session
if @session.empty? || @session[:session_id] <= 0
if @session.empty?
raise RTSP::Error, "Session number not retrieved from server yet. Run SETUP first."
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rtsp/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def parse_head head

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
Expand Down
2 changes: 1 addition & 1 deletion spec/rtsp/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def setup_client_at(url)
it "extracts the session number" do
@client.session.should be_empty
@client.setup("rtsp://localhost/some_track")
@client.session[:session_id].should == 1234567890
@client.session[:session_id].should == "1234567890"
end

it "changes the session_state to :ready" do
Expand Down
8 changes: 4 additions & 4 deletions spec/rtsp/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
it "creates a :session reader with value being a Hash with key/value" do
subject.stub(:extract_status_line)
subject.should_receive(:create_reader).with("session",
{ session_id: 118, timeout: 49 })
{ session_id: "118", timeout: 49 })
subject.parse_head(head)
end
end
Expand All @@ -40,7 +40,7 @@
it "creates a :session reader with value being a Hash with key/value" do
subject.stub(:extract_status_line)
subject.should_receive(:create_reader).with("session",
{ session_id: 118 })
{ session_id: "118" })
subject.parse_head(head)
end
end
Expand Down Expand Up @@ -181,7 +181,7 @@
end

it "returns the session" do
@response.session[:session_id].should == 118
@response.session[:session_id].should == "118"
end
end

Expand All @@ -207,7 +207,7 @@
end

it "returns the session" do
@response.session[:session_id].should == 118
@response.session[:session_id].should == "118"
end

it "returns the rtp_info" do
Expand Down