changeset 1354:4751e9febbbf

server: fixed HTTPS redirection
author Goffi <goffi@goffi.org>
date Sun, 13 Sep 2020 15:01:24 +0200
parents d1032f9ece5b
children 6f342b36871c
files libervia/server/server.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/server.py	Sun Sep 13 15:01:22 2020 +0200
+++ b/libervia/server/server.py	Sun Sep 13 15:01:24 2020 +0200
@@ -1646,11 +1646,11 @@
         self.new_port = new_port
 
     def render(self, request):
-        netloc = request.URLPath().netloc.replace(
-            ":%s" % self.old_port, ":%s" % self.new_port
+        netloc = request.URLPath().netloc.decode().replace(
+            f":{self.old_port}", f":{self.new_port}"
         )
-        url = "https://" + netloc + request.uri
-        return web_util.redirectTo(url, request)
+        url = f"https://{netloc}{request.uri.decode()}"
+        return web_util.redirectTo(url.encode(), request)
 
 
 registerAdapter(session_iface.SATSession, server.Session, session_iface.ISATSession)