summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorms <ms@taler.net>2021-11-25 21:43:44 +0100
committerms <ms@taler.net>2021-11-25 21:43:44 +0100
commit8bc85c2c38de04dd4c350598d1e1c78470031bf1 (patch)
tree366539fa95b2ec5f949cf8157a95eaf6f64f1365
parent47b604a9e642712d2bf2df987b97de13d4cc981c (diff)
downloaddeployment-8bc85c2c38de04dd4c350598d1e1c78470031bf1.tar.gz
deployment-8bc85c2c38de04dd4c350598d1e1c78470031bf1.tar.bz2
deployment-8bc85c2c38de04dd4c350598d1e1c78470031bf1.zip
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.
-rwxr-xr-xbin/WIP/taler-local23
1 files 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(