From 2d11ea7de5b560bdc426dc424594cab2517d7ce2 Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Wed, 23 Mar 2016 17:56:03 +0100 Subject: [PATCH] do not replace all the occurences of target in location header --- mandaye/filters/default.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mandaye/filters/default.py b/mandaye/filters/default.py index 9caf646..250e99d 100644 --- a/mandaye/filters/default.py +++ b/mandaye/filters/default.py @@ -38,7 +38,7 @@ class MandayeFilter(object): # Modify headers if response.headers.has_key('location'): response.headers.addheader('location', - re.sub(r'http(s*)://%s' % env["target"].hostname, + re.sub(r'^http(s*)://%s' % env["target"].hostname, r"%s://%s" % (env["mandaye.scheme"], env["HTTP_HOST"]), response.headers.getheader('location'), flags=re.IGNORECASE) @@ -131,4 +131,3 @@ class MandayeFilter(object): """ if request.msg and not isinstance(request.msg, basestring): request.msg = request.msg.read() -