The attached patch enables MPlayer using librtsp to connect to the RTSP server.

When running

    mplayer rtsp://10.10.4.10/

then it sends the OPTIONS URL like this: OPTIONS rtsp://10.10.4.10:554 RTSP/1.0 note there's no trailing slash after the port and the current code fails to parse it and sends back a Bad Request reply.

Tamas

--- live-2012.09.07.orig/liveMedia/RTSPCommon.cpp	2012-09-07 18:07:07.000000000 -0400
+++ live-2012.09.07/liveMedia/RTSPCommon.cpp	2012-09-10 16:26:23.918037653 -0400
@@ -92,18 +92,44 @@
       unsigned k1 = k;
       while (k1 > i && reqStr[k1] != '/') --k1;
 
+      /*
+	OPTIONS rtsp://10.10.4.10:554 RTSP/1.0
+				     | i: 1st space or slash after host:port
+				    | k: first non-space before RTSP/1.0
+		      | k1: first slash before k
+
+	OPTIONS rtsp://10.10.4.10/ RTSP/1.0
+				 | i,k,k1
+
+	OPTIONS rtsp://10.10.4.10/haha RTSP/1.0
+				 | i
+				     | k
+				 | k1
+
+	OPTIONS rtsp://10.10.4.10/haha/hehe RTSP/1.0
+				 | i
+					  | k
+				      | k1	
+      */
+
       // The URL suffix comes from [k1+1,k]
       // Copy "resultURLSuffix":
-      if (k - k1 + 1 > resultURLSuffixMaxSize) return False; // there's no room
       unsigned n = 0, k2 = k1+1;
-      while (k2 <= k) resultURLSuffix[n++] = reqStr[k2++];
+      if(i <= k)	// run this block only if there's a slash in the URL after host:port
+      {			// otherwise it would fail on URLs like rtsp://10.10.4.10:554 (no trailing slash)
+        if (k - k1 + 1 > resultURLSuffixMaxSize) return False; // there's no room
+        while (k2 <= k) resultURLSuffix[n++] = reqStr[k2++];
+      }
       resultURLSuffix[n] = '\0';
 
       // The URL 'pre-suffix' comes from [i+1,k1-1]
       // Copy "resultURLPreSuffix":
-      if (k1 - i > resultURLPreSuffixMaxSize) return False; // there's no room
       n = 0; k2 = i + 1;
-      while (k2 <= k1 - 1) resultURLPreSuffix[n++] = reqStr[k2++];
+      if(i <= k)	// run this block only if there's a slash in the URL after host:port
+      {			// otherwise it would fail on URLs like rtsp://10.10.4.10:554 (no trailing slash)
+        if (k1 - i > resultURLPreSuffixMaxSize) return False; // there's no room
+        while (k2 <= k1 - 1) resultURLPreSuffix[n++] = reqStr[k2++];
+      }
       resultURLPreSuffix[n] = '\0';
 
       i = k + 7; // to go past " RTSP/"
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to