[glib/carlosgc/remove-dot-segments] guri: always apply the remove dot segments algorithm




commit 7e428aa4e52da8db7960d0a41ea8cbdd6ce7a96d
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Wed May 5 15:13:16 2021 +0200

    guri: always apply the remove dot segments algorithm
    
    And not only when g_uri_parse_relative() is called with a base uri. This
    follows the spec and it's compatible with SoupURI.
    
    Fixes #2342

 glib/guri.c      | 4 ++++
 glib/tests/uri.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/glib/guri.c b/glib/guri.c
index a57c670ac..2c94efbc6 100644
--- a/glib/guri.c
+++ b/glib/guri.c
@@ -1508,6 +1508,10 @@ g_uri_parse_relative (GUri         *base_uri,
           uri->port = normalize_port (uri->scheme, uri->port);
         }
     }
+  else
+    {
+      remove_dot_segments (uri->path);
+    }
 
   return g_steal_pointer (&uri);
 }
diff --git a/glib/tests/uri.c b/glib/tests/uri.c
index 1f3209f97..7a251af64 100644
--- a/glib/tests/uri.c
+++ b/glib/tests/uri.c
@@ -714,7 +714,7 @@ static const UriAbsoluteTest absolute_tests[] = {
 
   /* ".." past top */
   { "http://example.com/..";, G_URI_FLAGS_NONE, TRUE, 0,
-    { "http", NULL, "example.com", -1, "/..", NULL, NULL }
+    { "http", NULL, "example.com", -1, "/", NULL, NULL }
   },
 
   /* scheme parsing */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]