parent
d6f82392e0
commit
00ba2176af
|
@ -36,12 +36,14 @@ class MandayeFilter(object):
|
|||
cookie['domain'] = re.sub('^\.*%s$' % (target.hostname),
|
||||
src_hostname, cookie['domain'])
|
||||
# Modify headers
|
||||
if response.headers.has_key('location'):
|
||||
response.headers.addheader('location',
|
||||
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)
|
||||
)
|
||||
blacklist = ['transfer-encoding', 'content-length']
|
||||
for key, value in response.headers.iteritems():
|
||||
if key == 'location':
|
||||
location = value[0].replace(target.geturl(),
|
||||
"%s://%s" % (env['mandaye.scheme'], env["HTTP_HOST"]))
|
||||
response.headers['location'] = [location]
|
||||
for name in blacklist:
|
||||
if response.headers.has_key(name):
|
||||
del response.headers[name]
|
||||
|
|
|
@ -48,7 +48,7 @@ def _get_traceback():
|
|||
return tb_str
|
||||
|
||||
def _302(location, cookies=None):
|
||||
headers = HTTPHeader({'Location': [location],
|
||||
headers = HTTPHeader({'location': [location],
|
||||
'Content-Type': ['text/html']})
|
||||
msg = "Reload the page to get source for: %s" % location
|
||||
logger.info('302 redirect to %s' % location)
|
||||
|
|
Reference in New Issue