aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/util/dummy_http.py
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2021-04-13 14:06:36 +0100
committerAndrew Lewis <nerf@judo.za.org>2021-04-13 14:06:36 +0100
commit548f11798641f7933f6e7b20a621f91f58ccc23e (patch)
tree896282113f0ca77fb6d5904d3877708ce98533f0 /test/functional/util/dummy_http.py
parent125664ba6cf0154c65691441a9fb3b9dc120336d (diff)
downloadrspamd-548f11798641f7933f6e7b20a621f91f58ccc23e.tar.gz
rspamd-548f11798641f7933f6e7b20a621f91f58ccc23e.zip
[Test] url-redirector
Diffstat (limited to 'test/functional/util/dummy_http.py')
-rwxr-xr-xtest/functional/util/dummy_http.py19
1 files changed, 16 insertions, 3 deletions
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"