diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-01-17 17:16:42 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-01-17 17:16:42 +0100 |
commit | 2769f0bcf6c1ac73e883f47857fa227de92f4525 (patch) | |
tree | 11e0b4e9ff2388b38cead5c8a56746c77b006c2a | |
parent | cae9cdcefc34eba6d023cb30cbbdb9bbf909b8fe (diff) | |
download | apt-2769f0bcf6c1ac73e883f47857fa227de92f4525.tar.gz |
* mirror-failure.py: example mirror failure cgi
* methods/mirror.cc: prepare for the failure submit
-rw-r--r-- | methods/mirror.cc | 6 | ||||
-rw-r--r-- | mirror-failure.py | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc index 428726a3d..6621d47e2 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -247,6 +247,12 @@ void MirrorMethod::ReportMirrorFailure(string FailCode) << Queue->Uri << " FailCode: " << FailCode << std::endl; +#if 0 // FIXME: do not use system, make sure to properly encode + // URI/FailCode, do not hardcode the submit url + system("curl -d url=" + Queue->Uri + + " -d FailureCode=" + FailCode + + " http://localhost:8000/ &"); +#endif } int main() diff --git a/mirror-failure.py b/mirror-failure.py new file mode 100644 index 000000000..e7d2bbf54 --- /dev/null +++ b/mirror-failure.py @@ -0,0 +1,23 @@ +# File: cgihttpserver-example-1.py + +import CGIHTTPServer +import BaseHTTPServer + +class Handler(CGIHTTPServer.CGIHTTPRequestHandler): + #cgi_directories = ["/cgi"] + def do_POST(self): + print "do_POST" + #print self.command + #print self.path + #print self.headers + print self.client_address + data = self.rfile.read(int(self.headers["content-length"])) + print data + self.wfile.write("200 Ok\n"); + +PORT = 8000 + +httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) +print "serving at port", PORT +httpd.serve_forever() + |