]> git.saurik.com Git - apt.git/commitdiff
* mirror-failure.py: example mirror failure cgi
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 17 Jan 2007 16:16:42 +0000 (17:16 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 17 Jan 2007 16:16:42 +0000 (17:16 +0100)
* methods/mirror.cc: prepare for the failure submit

methods/mirror.cc
mirror-failure.py [new file with mode: 0644]

index 428726a3d197cb42ea314adb7eedbb39654de73c..6621d47e2686d738d594938ae42dd0c972158d79 100644 (file)
@@ -247,6 +247,12 @@ void MirrorMethod::ReportMirrorFailure(string FailCode)
             << Queue->Uri
             << " FailCode: " 
             << FailCode << std::endl;
             << 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()
 }
 
 int main()
diff --git a/mirror-failure.py b/mirror-failure.py
new file mode 100644 (file)
index 0000000..e7d2bbf
--- /dev/null
@@ -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()
+