Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
* mirror-failure.py: example mirror failure cgi
Browse files Browse the repository at this point in the history
* methods/mirror.cc: prepare for the failure submit
  • Loading branch information
mvo5 committed Jan 17, 2007
1 parent cae9cdc commit 2769f0b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions methods/mirror.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
23 changes: 23 additions & 0 deletions mirror-failure.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 2769f0b

Please sign in to comment.