]> granicus.if.org Git - rtmpdump/commitdiff
Can't use URL coding for embedded spaces in SetupURL. Instead use TAB combos
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 28 Mar 2010 08:01:00 +0000 (08:01 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 28 Mar 2010 08:01:00 +0000 (08:01 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@409 400ebc74-4327-4243-bc38-086b20814532

librtmp/rtmp.c

index 4e4d790c0456c286174dc5724f808c2eb94caa48..ffe32e89b1ba6e749d83aefe0dd58e64fb3be58a 100644 (file)
@@ -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--;