[rtmpdump] [PATCH 2/2] librtmp/parseurl: don't re-encode everything

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


Part of my URL goes like this:
  mp;clip=%27Alle+Beitr%E4ge+-+di

The code now converts %27 into ' and %e4 into ä. The first conversion of
%27 seems fine but the second isn't since it is not an ascii character and
this on has to be encoded with the % and sent as is.
I believe the only reason here is to keep URL human readable where
possible.

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

diff --git a/librtmp/parseurl.c b/librtmp/parseurl.c
index 95562d4..c68da2e 100644
--- a/librtmp/parseurl.c
+++ b/librtmp/parseurl.c
@@ -284,9 +284,14 @@ void RTMP_ParsePlaypath(AVal *in, AVal *out) {
 		if (*p == '%') {
 			unsigned int c;
 			sscanf(p+1, "%02x", &c);
-			*destptr++ = c;
-			pplen -= 3;
-			p += 3;
+			if (isascii(c)) {
+				*destptr++ = c;
+				pplen -= 3;
+				p += 3;
+			} else {
+				*destptr++ = *p++;
+				pplen--;
+			}
 		} else {
 			*destptr++ = *p++;
 			pplen--;
-- 
1.7.10.4



More information about the rtmpdump mailing list