diff --git a/document.py b/document.py index 08ec242..968e37f 100644 --- a/document.py +++ b/document.py @@ -45,8 +45,8 @@ def request (self, url): #Sends a HTTP request (useful for HTTP APIS). If you do return(f.read().decode('utf-8')) def send (self): #Send the answer to the browser - self.connection.send_header(self.header[0], self.header[1]) self.connection.send_response(self.response) + self.connection.send_header(self.header[0], self.header[1]) self.connection.end_headers() if (self.response != 302): diff --git a/server.py b/server.py index e03bf45..fd9b009 100644 --- a/server.py +++ b/server.py @@ -52,8 +52,8 @@ def do_GET(self): #Decide wether a search or the style.css was requested if (path == "/style.css"): self.document = open('style.css', 'r').read() - self.send_header('Content-type', 'text/html') self.send_response(200) + self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write(bytes(self.document, "utf-8")) elif (path == "/proxy.pac"): @@ -62,8 +62,8 @@ def do_GET(self): self.document = self.document.replace('', google_domain, 1) self.document = self.document.replace('', squid_hostname, 1) self.document = self.document.replace('', str(squid_port), 1) - self.send_header('Content-type', 'x-ns-proxy-autoconfig') self.send_response(200) + self.send_header('Content-type', 'x-ns-proxy-autoconfig') self.end_headers() self.wfile.write(bytes(self.document, "utf-8")) elif (arguments["q"] != None): @@ -72,8 +72,8 @@ def do_GET(self): command = commands(self) search(command).search(arguments["q"]) else: - self.send_header('Content-type', 'text/html') self.send_response(404) + self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write(bytes('Not found. Please visit https://github.com/HcDevel/Siri-API/wiki/_pages', "utf-8"))