[rtmpdump] [PATCH 2/2] librtmp/parseurl: don't re-encode everything
David Sainty
dave at dtsp.co.nz
Sat May 25 01:20:23 CEST 2013
Sebastian Andrzej Siewior <sebastian at breakpoint.cc> wrote:
>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--;
If you are going to do that, you'd better also not decode the ascii character '%'.
More information about the rtmpdump
mailing list