soup-uri: don't decode %00 in URIs
authorDan Winship <danw@gnome.org>
Mon, 10 Dec 2012 21:20:59 +0000 (22:20 +0100)
committerDan Winship <danw@gnome.org>
Mon, 10 Dec 2012 21:20:59 +0000 (22:20 +0100)
We were accidentally decoding %00 to '\0' in URIs, causing a few
WebKit tests to fail. Leave it undecoded instead.

libsoup/soup-uri.c
tests/uri-parsing.c

index 709d3ad..c1d5720 100644 (file)
@@ -709,7 +709,7 @@ uri_normalized_copy (const char *part, int length,
 
                        c = HEXCHAR (s);
                        if (soup_char_is_uri_unreserved (c) ||
-                           strchr (unescape_extra, c)) {
+                           (c && strchr (unescape_extra, c))) {
                                *d++ = c;
                                s += 3;
                        } else {
index 166a6d8..892ee2b 100644 (file)
@@ -125,6 +125,9 @@ static struct {
          { "http", "", NULL, "host", 80, "/", NULL, NULL } },
        { "http://:@host", "http://@host/",
          { "http", "", "", "host", 80, "/", NULL, NULL } },
+
+       { "http://host/keep%00nuls", "http://host/keep%00nuls",
+         { "http", NULL, NULL, "host", 80, "/keep%00nuls", NULL, NULL } },
 };
 static int num_abs_tests = G_N_ELEMENTS(abs_tests);