[epiphany/mcatanzaro/#1076] view-source-handler: don't lose port number when comparing views



commit a9adc8b284288ba028bdb38089d8f01e2e785b55
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Jan 29 10:38:11 2020 -0600

    view-source-handler: don't lose port number when comparing views
    
    We fail to find an existing tab displaying the target URI if it includes
    a non-default port, because soup_uri_set_scheme() resets the port to use
    the default for the given scheme.
    
    Credit to crvi for debugging.
    
    Fixes #1076

 embed/ephy-view-source-handler.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/embed/ephy-view-source-handler.c b/embed/ephy-view-source-handler.c
index 43fb9be17..ada11c6c1 100644
--- a/embed/ephy-view-source-handler.c
+++ b/embed/ephy-view-source-handler.c
@@ -237,6 +237,7 @@ out:
 static void
 ephy_view_source_request_start (EphyViewSourceRequest *request)
 {
+  guint port;
   SoupURI *soup_uri;
   char *modified_uri;
   char *decoded_fragment;
@@ -260,9 +261,13 @@ ephy_view_source_request_start (EphyViewSourceRequest *request)
     return;
   }
 
-  /* Convert e.g. ephy-source://gnome.org#https to https://gnome.org */
+  /* Convert e.g. ephy-source://gnome.org#https to https://gnome.org, taking
+   * care to prevent soup_uri_set_scheme() from forcing the default port.
+   */
   decoded_fragment = soup_uri_decode (soup_uri->fragment);
+  port = soup_uri_get_port (soup_uri);
   soup_uri_set_scheme (soup_uri, decoded_fragment);
+  soup_uri_set_port (soup_uri, port);
   soup_uri_set_fragment (soup_uri, NULL);
   modified_uri = soup_uri_to_string (soup_uri, FALSE);
   g_assert (modified_uri);


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