Don't replace '+' with ' ' when decoding URLs - quark - quark web server
git clone git://git.suckless.org/quark
Log
Files
Refs
LICENSE
---
commit e299e186edba03192fc12f6709df48d02aa83849
parent bbd47e1427940e0d4f22a098acd593c1365accd3
Author: Laslo Hunhold 
Date:   Thu, 10 Jan 2019 22:02:23 +0100

Don't replace '+' with ' ' when decoding URLs

After the initial report by Platon Ryzhikov, I couldn't validate this
behaviour with the given RFC 3986[0], which only speaks of percent encoding
for reserved characters.

[0]:https://tools.ietf.org/html/rfc3986

Signed-off-by: Laslo Hunhold 

Diffstat:
  M http.c                              |       4 +---

1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/http.c b/http.c
@@ -80,9 +80,7 @@ decode(char src[PATH_MAX], char dest[PATH_MAX])
         char *s;
 
         for (s = src, i = 0; *s; s++, i++) {
-                if (*s == '+') {
-                        dest[i] = ' ';
-                } else if (*s == '%' && (sscanf(s + 1, "%2hhx", &n) == 1)) {
+                if (*s == '%' && (sscanf(s + 1, "%2hhx", &n) == 1)) {
                         dest[i] = n;
                         s += 2;
                 } else {