summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Muizelaar <jmuizelaar@mozilla.com>2010-12-14 11:01:23 -0800
committerJeff Muizelaar <jmuizelaar@mozilla.com>2010-12-14 11:01:23 -0800
commita125548f093d6dc3c99f5d1ba91bfa2b3d3fe24b (patch)
tree6772d24ddc55dd0f5c81a824523736f1b5ccdbe4
parent433d824dbc7de7fc1c075bf27b768afd92b32622 (diff)
Don't hardcode the "log" prefix all over the place.
-rwxr-xr-xTinyHTTPProxy.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/TinyHTTPProxy.py b/TinyHTTPProxy.py
index 824703e..08e51fe 100755
--- a/TinyHTTPProxy.py
+++ b/TinyHTTPProxy.py
@@ -18,6 +18,8 @@ replay = False
import BaseHTTPServer, select, socket, SocketServer, urlparse, urllib
import os
+prefix = "log"
+
class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
__base = BaseHTTPServer.BaseHTTPRequestHandler
__base_handle = __base.handle
@@ -92,13 +94,13 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
current_file_name = substitute(current_file_name)
if replay:
- result = open("log/" + current_file_name, "r")
+ result = open(prefix + "/" + current_file_name, "r")
print urllib.quote(self.path, "")
self.connection.send(result.read())
self.connection.close()
self.log_request()
return
- self.current_file = open("log/" + current_file_name, "w+")
+ self.current_file = open(prefix + "/" + current_file_name, "w+")
if scm != 'http' or fragment or not netloc:
self.send_error(400, "bad url %s" % self.path)
return
@@ -158,7 +160,7 @@ class ThreadingHTTPServer (SocketServer.ThreadingMixIn,
if __name__ == '__main__':
from sys import argv
try:
- os.mkdir('log')
+ os.mkdir(prefix)
except:
pass