gnunet-svn
[Top][All Lists]
Advanced

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

[taler-deployment] branch master updated: taler-local proxy


From: gnunet
Subject: [taler-deployment] branch master updated: taler-local proxy
Date: Thu, 25 Nov 2021 21:49:26 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 8bc85c2  taler-local proxy
8bc85c2 is described below

commit 8bc85c2c38de04dd4c350598d1e1c78470031bf1
Author: ms <ms@taler.net>
AuthorDate: Thu Nov 25 21:43:44 2021 +0100

    taler-local proxy
    
    - enforce sending individual Set-Cookie headers,
    instead of one that contains several.
    - enforce question marks that are actually part of
    a URL path to be sent URL-encoded.
---
 bin/WIP/taler-local | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/bin/WIP/taler-local b/bin/WIP/taler-local
index c30fbc4..7fe431a 100755
--- a/bin/WIP/taler-local
+++ b/bin/WIP/taler-local
@@ -366,7 +366,6 @@ def build(without_repos, only_repos) -> None:
     if only_repos != "" and without_repos != "":
         print("Either use --only-repos or --without-repos")
         exit(1)
-
     repos_names = get_repos_names()
     if only_repos != "":
         repos_names = list(filter(
@@ -513,7 +512,7 @@ class TalerReverseProxy(Flask):
 
             socket_path = f"{self.unix_sockets_dir}/{component}.sock"
             self.logger.debug("Proxying to: " + socket_path + "/" + path)
-            uri = f"http+unix://{quote(socket_path, safe='')}/{path}"
+            uri = f"http+unix://{quote(socket_path, 
safe='')}/{path.replace('?', '%3F')}"
             if len(request.args) > 0:
                 uri += f"?{request.query_string.decode()}"
             resp = method(
@@ -539,12 +538,29 @@ class TalerReverseProxy(Flask):
             # the following header would confuse the client.
             if k == "Content-Encoding" and (resp.headers[k] in ["deflate", 
"gzip"]):
                 continue
+            # 'requests' collapses multiple Set-Cookies response headers
+            # into one (comma-separated list of cookie definitions).  That
+            # breaks browsers' cookie acceptance, resulting in HTTP sessions
+            # being lost.  A typical example is the blog shop not functioning
+            # for this reason.
+            #
+            # Skipping here, as it appears to _still_ collapse them, even if
+            # each one is individually set.  Trying below via the "final" flask
+            # Response object.
+            if k == "Set-Cookie":
+                continue
             headers.set(k, resp.headers[k])
-        return Response(
+
+        Resp = Response(
             response=resp.text,
             status=resp.status_code,
             headers=headers,
         )
+        if "Set-Cookie" in resp.headers:
+            cookies = resp.headers["Set-Cookie"].split(",")
+            for cookie in cookies:
+                Resp.headers.add("Set-Cookie", cookie.strip())
+        return Resp
 
     def get_app(self):
         return self
@@ -715,7 +731,6 @@ def prepare():
             env = customer_env,
             capture_stdout=True
         ).run()
-        print("MEGA DEBUG " + r)
         return json.loads(r)
 
     def prepare_sandbox_account(

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]