[rtmpdump] [PATCH 1/2] librtmp/parseurl: ignore slashes past mp4:

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Fri May 24 12:55:32 CEST 2013


My URL looks the following:
  rtmp://vod.daserste.de:8080/ardfs/mp4:videoportal/mediathek/Plusminus/c_320000/321891/format406703.mp4?&sen=Plusminus&clip=%27Al…

and the parser creates interprets this as:

  app : 'ardfs/mp4:videoportal/mediathek'
  path: 'mp4:Plusminus/c_320000/321891/format406703?&sen=Plusminus&cl…

The application is too long, as it is only "ardfs" and as a result the
playpath gets wrong. I have no idea why it looks for so many slashes
because the application should end after the first slash before the mp4:
string. Commit f3e3e6b5 ("Look for a fourth slash when splitting the url
into app+playpath") added even another one and I have no idea why.

For the time now I ignore all slashes past "mp[34]:" since this should be
this should mark the end the application and the start of the playpath.

Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
---
 librtmp/parseurl.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/librtmp/parseurl.c b/librtmp/parseurl.c
index 646c70c..95562d4 100644
--- a/librtmp/parseurl.c
+++ b/librtmp/parseurl.c
@@ -34,6 +34,7 @@ int RTMP_ParseURL(const char *url, int *protocol, AVal *host, unsigned int *port
 	AVal *playpath, AVal *app)
 {
 	char *p, *end, *col, *ques, *slash;
+	char *mp_str;
 
 	RTMP_Log(RTMP_LOGDEBUG, "Parsing...");
 
@@ -130,6 +131,9 @@ parsehost:
 	}
 	p = slash+1;
 
+	mp_str = strstr(p, "mp4:");
+	if (!mp_str)
+		mp_str = strstr(p, "mp3:");
 	{
 	/* parse application
 	 *
@@ -141,10 +145,16 @@ parsehost:
 	int applen, appnamelen;
 
 	slash2 = strchr(p, '/');
-	if(slash2)
+	if(slash2) {
 		slash3 = strchr(slash2+1, '/');
-	if(slash3)
+		if (mp_str && slash3 > mp_str)
+			slash3 = NULL;
+	}
+	if(slash3) {
 		slash4 = strchr(slash3+1, '/');
+		if (mp_str && slash4 > mp_str)
+			slash4 = NULL;
+	}
 
 	applen = end-p; /* ondemand, pass all parameters as app */
 	appnamelen = applen; /* ondemand length */
-- 
1.7.10.4



More information about the rtmpdump mailing list