codec/url.c: Always encode whitespace characters.
[mLib] / codec / url.c
index f502f7c..4e7f190 100644 (file)
@@ -67,7 +67,8 @@ static void encode(url_ectx *ctx, dstr *d, const char *p)
        DPUTC(d, '+');
        break;
       default:
-       if ((ctx->f & URLF_LAX) || isalnum((unsigned char)*p))
+       if (!isspace((unsigned char)*p) &&
+           ((ctx->f & URLF_LAX) || isalnum((unsigned char)*p)))
          goto safe;
        else
          goto unsafe;