From 548f11798641f7933f6e7b20a621f91f58ccc23e Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 13 Apr 2021 14:06:36 +0100 Subject: [Test] url-redirector --- test/functional/util/dummy_http.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'test/functional/util/dummy_http.py') diff --git a/test/functional/util/dummy_http.py b/test/functional/util/dummy_http.py index c05ee2d02..4bec24119 100755 --- a/test/functional/util/dummy_http.py +++ b/test/functional/util/dummy_http.py @@ -10,7 +10,7 @@ import time import dummy_killer PORT = 18080 -HOST_NAME = '127.0.0.1' +HOST_NAME = '0.0.0.0' PID = "/tmp/dummy_http.pid" @@ -22,10 +22,23 @@ class MyHandler(http.server.BaseHTTPRequestHandler): self.protocol_version = "HTTP/1.1" # allow connection: keep-alive def do_HEAD(self): - self.send_response(200) + if self.path == "/redirect1": + self.send_response(301) + self.send_header("Location", "http://127.0.0.1:"+str(PORT)+"/hello") + elif self.path == "/redirect2": + self.send_response(301) + self.send_header("Location", "http://127.0.0.1:"+str(PORT)+"/redirect1") + elif self.path == "/redirect3": + self.send_response(301) + self.send_header("Location", "http://127.0.0.1:"+str(PORT)+"/redirect4") + elif self.path == "/redirect4": + self.send_response(301) + self.send_header("Location", "http://127.0.0.1:"+str(PORT)+"/redirect3") + else: + self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() - self.log_message("to be closed: " + self.close_connection) + self.log_message("to be closed: " + repr(self.close_connection)) def do_GET(self): response = b"hello world" -- cgit v1.2.3