diff --git a/src/httpserver.py b/src/httpserver.py index 0ab25b4f5..cc86812b5 100644 --- a/src/httpserver.py +++ b/src/httpserver.py @@ -306,11 +306,12 @@ class SupyHTTPServerCallback(log.Firewalled): self.wfile.write(s) def doGet(self, handler, path, *args, **kwargs): + response = self.defaultResponse.encode() handler.send_response(405) self.send_header('Content-Type', 'text/plain; charset=utf-8; charset=utf-8') - self.send_header('Content-Length', len(self.defaultResponse)) + self.send_header('Content-Length', len(response)) self.end_headers() - self.wfile.write(self.defaultResponse.encode()) + self.wfile.write(response) doPost = doHead = doGet @@ -331,13 +332,13 @@ class Supy404(SupyHTTPServerCallback): What I'm saying is you just triggered a 404 Not Found, and I am not trained to help you in such a case.""") def doGet(self, handler, path, *args, **kwargs): + response = self.response + if minisix.PY3: + response = response.encode() handler.send_response(404) self.send_header('Content-Type', 'text/plain; charset=utf-8; charset=utf-8') self.send_header('Content-Length', len(self.response)) self.end_headers() - response = self.response - if minisix.PY3: - response = response.encode() self.wfile.write(response) doPost = doHead = doGet @@ -355,12 +356,12 @@ class SupyIndex(SupyHTTPServerCallback): plugins = '