From 21639e4fd0cdfccafda412b68f728e0c1cb37dcc Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 27 Mar 2013 15:44:47 +0000 Subject: [PATCH] GitHub: Reply more nicely to POST requests. --- GitHub/plugin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GitHub/plugin.py b/GitHub/plugin.py index ab2c464..678e753 100644 --- a/GitHub/plugin.py +++ b/GitHub/plugin.py @@ -74,7 +74,15 @@ class GithubCallback(httpserver.SupyHTTPServerCallback): not handler.address_string() == 'localhost': log.warning("""'%s' tried to act as a web hook for Github, but is not GitHub.""" % handler.address_string()) + self.send_response(403) + self.send_header('Content-type', 'text/plain') + self.end_headers() + self.wfile.write('Error: you are not a GitHub server.') else: + self.send_response(200) + self.send_header('Content-type', 'text/plain') + self.end_headers() + self.wfile.write('Thanks.') self.plugin.announce.onPayload(json.loads(form['payload'].value)) #####################