[rtmpdump] r409 - trunk/librtmp/rtmp.c

hyc subversion at mplayerhq.hu
Sun Mar 28 10:01:01 CEST 2010


Author: hyc
Date: Sun Mar 28 10:01:00 2010
New Revision: 409

Log:
Can't use URL coding for embedded spaces in SetupURL. Instead use TAB combos

Modified:
   trunk/librtmp/rtmp.c

Modified: trunk/librtmp/rtmp.c
==============================================================================
--- trunk/librtmp/rtmp.c	Sun Mar 28 08:45:20 2010	(r408)
+++ trunk/librtmp/rtmp.c	Sun Mar 28 10:01:00 2010	(r409)
@@ -645,15 +645,25 @@ bool RTMP_SetupURL(RTMP *r, char *url)
       arg.av_len = strlen(p2);
     }
 
-    /* urldecode */
+    /* Decode embedded spaces. Spaces are encoded as TAB+Ctrl-A.
+     * TABs are encoded as TAB+Ctrl-B. For TAB+anything else the
+     * TAB is dropped.
+     */
     port = arg.av_len;
     for (p1=p2; port >0;) {
-      if (*p1 == '%') {
-	int c;
-	sscanf(p1+1, "%02x", &c);
-	*p2++ = c;
-	port -= 3;
-	p1 += 3;
+      if (*p1 == 0x08) {
+        if (p1[1] == 0x01) {
+	  *p2++ = ' ';
+	  port -= 2;
+	  p1 += 2;
+	} else if (p1[1] == 0x02) {
+	  *p2++ = 0x08;
+	  port -= 2;
+	  p1 += 2;
+	} else {
+	  p1++;
+	  port--;
+	}
       } else {
 	*p2++ = *p1++;
 	port--;


More information about the rtmpdump mailing list