commit 7f54b3675a9d62d930dc1842be0253d588178f0d Author: David Fifield david@bamsoftware.com Date: Thu Jul 28 16:04:33 2011 +0000
Gracefully handle the case when a request is so broken it doesn't have headers. --- facilitator.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/facilitator.py b/facilitator.py index eaad855..287602d 100755 --- a/facilitator.py +++ b/facilitator.py @@ -272,7 +272,10 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def log_request(self, code): addr_s = format_addr(self.client_address) - referer = self.headers.get("Referer") or "-" + try: + referer = self.headers["Referer"] + except (AttributeError, KeyError): + referer = "-" log(u"resp %s %s %d %s" % (addr_s, repr(self.requestline), code, repr(referer)))
tor-commits@lists.torproject.org