Skip to content

Commit

Permalink
-- fixed a bug in RTMP uri parsing
Browse files Browse the repository at this point in the history
-- fixed some issues inside config files


git-svn-id: https://svn.rtmpd.com/crtmpserver/trunk@730 01689507-d990-df11-9d7d-0017a411d416
  • Loading branch information
shiretu committed Jan 29, 2012
1 parent 3c8aab5 commit 9928e1e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
5 changes: 3 additions & 2 deletions builders/cmake/crtmpserver/crtmpserver.lua
Expand Up @@ -151,8 +151,9 @@ configuration=
{
uri="rtmp://edge01.fms.dutchview.nl/botr/bunny",
localStreamName="rtmp_test",
swfUrl="http://www.example.com/example.swf";
pageUrl="http://www.example.com/";
swfUrl="http://www.example.com/example.swf",
pageUrl="http://www.example.com/",
tcUrl="rtmp://edge01.fms.dutchview.nl/botr/bunny", --this one is usually required and should have the same value as the uri
emulateUserAgent="MAC 10,1,82,76",
}]]--
},
Expand Down
25 changes: 4 additions & 21 deletions configs/all.debug.lua
Expand Up @@ -149,13 +149,15 @@ configuration=
uri="rtmp://edge01.fms.dutchview.nl/botr/bunny",
localStreamName="stream6",
emulateUserAgent="MAC 10,1,82,76",
tcUrl="rtmp://edge01.fms.dutchview.nl/botr/bunny", --this one is usually required and should have the same value as the uri
}
{
uri="rtmp://edge01.fms.dutchview.nl/botr/bunny",
localStreamName="stream6",
swfUrl="http://www.example.com/example.swf";
pageUrl="http://www.example.com/";
swfUrl="http://www.example.com/example.swf",
pageUrl="http://www.example.com/",
emulateUserAgent="MAC 10,1,82,76",
tcUrl="rtmp://edge01.fms.dutchview.nl/botr/bunny", --this one is usually required and should have the same value as the uri
}
]]--
},
Expand Down Expand Up @@ -313,25 +315,6 @@ configuration=
numberOfConnections=10,
randomAccessStreams=false
},
{
name="applestreamingclient",
description="Apple Streaming Client",
protocol="dynamiclinklibrary",
--[[acceptors =
{
{
ip="0.0.0.0",
port=5544,
protocol="inboundRtsp"
}
},]]--
aliases=
{
"asc",
},
--validateHandshake=true,
--default=true,
},
--[[{
name="vmapp",
description="An application demonstrating the use of virtual machines",
Expand Down
1 change: 1 addition & 0 deletions configs/flvplayback.lua
Expand Up @@ -79,6 +79,7 @@ configuration=
--[[{
uri="rtmp://edge01.fms.dutchview.nl/botr/bunny",
localStreamName="test1",
tcUrl="rtmp://edge01.fms.dutchview.nl/botr/bunny", --this one is usually required and should have the same value as the uri
}]]--
},
validateHandshake=true,
Expand Down
35 changes: 30 additions & 5 deletions sources/common/src/utils/misc/uri.cpp
Expand Up @@ -203,12 +203,37 @@ bool parseURI(string stringUri, URI &uri) {
}
}

for (string::size_type i = fullDocumentPath.size() - 1; i >= 0; i--) {
if (fullDocumentPath[i] == '/')
break;
document = fullDocumentPath[i] + document;
bool rtmpDocument = false;

if (scheme.find("rtmp") == 0) {
pos = fullDocumentPath.find(':');
if (pos == string::npos) {
rtmpDocument = false;
} else {
pos = fullDocumentPath.rfind('/', pos);
if (pos == string::npos) {
rtmpDocument = false;
} else {
rtmpDocument = true;
}
}
} else {
rtmpDocument = false;
}

if (rtmpDocument) {
pos = fullDocumentPath.find(':');
pos = fullDocumentPath.rfind('/', pos);
documentPath = fullDocumentPath.substr(0, pos + 1);
document = fullDocumentPath.substr(pos + 1);
} else {
for (string::size_type i = fullDocumentPath.size() - 1; i >= 0; i--) {
if (fullDocumentPath[i] == '/')
break;
document = fullDocumentPath[i] + document;
}
documentPath = fullDocumentPath.substr(0, fullDocumentPath.size() - document.size());
}
documentPath = fullDocumentPath.substr(0, fullDocumentPath.size() - document.size());
documentWithFullParameters = document;
if (fullParameters != "")
documentWithFullParameters += "?" + fullParameters;
Expand Down

0 comments on commit 9928e1e

Please sign in to comment.