tests/tinyproxy.py
branchstable
changeset 16300 74e114ac6ec1
parent 14971 0b21ae0a2366
child 16703 7292a4618f46
--- a/tests/tinyproxy.py	Wed Mar 28 12:02:38 2012 -0500
+++ b/tests/tinyproxy.py	Wed Mar 28 19:23:25 2012 -0500
@@ -12,7 +12,7 @@
 
 __version__ = "0.2.1"
 
-import BaseHTTPServer, select, socket, SocketServer, urlparse
+import BaseHTTPServer, select, socket, SocketServer, urlparse, os
 
 class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
     __base = BaseHTTPServer.BaseHTTPRequestHandler
@@ -122,7 +122,12 @@
     do_DELETE = do_GET
 
 class ThreadingHTTPServer (SocketServer.ThreadingMixIn,
-                           BaseHTTPServer.HTTPServer): pass
+                           BaseHTTPServer.HTTPServer):
+    def __init__(self, *args, **kwargs):
+        BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs)
+        a = open("proxy.pid", "w")
+        a.write(str(os.getpid()) + "\n")
+        a.close()
 
 if __name__ == '__main__':
     from sys import argv