gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated: The mitm do NOT cop


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: The mitm do NOT copy header Content-Lenght and Server into the response; it used to return ill-formed JSONs.
Date: Tue, 02 May 2017 09:01:54 +0200

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

marcello pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new ee0fb92  The mitm do NOT copy header Content-Lenght and Server into 
the response; it used to return ill-formed JSONs.
ee0fb92 is described below

commit ee0fb929d7bcb1dbcaf29ef88a38ad9b5e89e756
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue May 2 09:00:43 2017 +0200

    The mitm do NOT copy header Content-Lenght and Server into
    the response; it used to return ill-formed JSONs.
---
 src/mitm/talermerchantmitm/mitm.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/mitm/talermerchantmitm/mitm.py 
b/src/mitm/talermerchantmitm/mitm.py
index df33e24..6975f21 100644
--- a/src/mitm/talermerchantmitm/mitm.py
+++ b/src/mitm/talermerchantmitm/mitm.py
@@ -47,12 +47,6 @@ def track_transaction(resp):
 def track_transfer(resp):
     return resp
 
-def fallback(resp):
-    if "application/json" == resp.headers["Content-Type"]:
-        return make_response(jsonify(resp.json()))
-    else:
-        return make_response(resp.text)
-
 @app.route('/', defaults={'path': ''})
 @app.route('/<path:path>', methods=["GET", "POST"])
 def all(path):
@@ -71,8 +65,9 @@ def all(path):
         "track_transfer": track_transfer
     }
     func = dispatcher.get(request.headers.get("X-Taler-Mitm"),
-                          fallback)
+                          lambda x: make_response(x.text))
     response = func(r)
     for key, value in r.headers.items():
-        response.headers[key] = value
+        if key not in ("Server", "Content-Length"):
+            response.headers[key] = value
     return response, r.status_code

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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