Browse Source

* mirror-failure.py: example mirror failure cgi

* methods/mirror.cc: prepare for the failure submit
tags/devuan/2.0.1+devuan1
Michael Vogt 13 years ago
parent
commit
2769f0bcf6
2 changed files with 29 additions and 0 deletions
  1. +6
    -0
      methods/mirror.cc
  2. +23
    -0
      mirror-failure.py

+ 6
- 0
methods/mirror.cc View File

@@ -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()


+ 23
- 0
mirror-failure.py View File

@@ -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()


Loading…
Cancel
Save