hg serve: don't do DNS lookups
authorMatt Mackall <mpm@selenic.com>
Wed, 25 Apr 2007 13:35:18 -0500
changeset 4359 80d3f6f0d8e5
parent 4358 11dc22eb8e8d
child 4379 80c7fa620a4d
child 4396 c04c96504a12
child 4401 d1dd16256114
hg serve: don't do DNS lookups
mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py	Sat Jan 27 23:07:06 2007 +0100
+++ b/mercurial/hgweb/server.py	Wed Apr 25 13:35:18 2007 -0500
@@ -43,13 +43,13 @@
 
     def log_error(self, format, *args):
         errorlog = self.server.errorlog
-        errorlog.write("%s - - [%s] %s\n" % (self.address_string(),
+        errorlog.write("%s - - [%s] %s\n" % (self.client_address[0],
                                              self.log_date_time_string(),
                                              format % args))
 
     def log_message(self, format, *args):
         accesslog = self.server.accesslog
-        accesslog.write("%s - - [%s] %s\n" % (self.address_string(),
+        accesslog.write("%s - - [%s] %s\n" % (self.client_address[0],
                                               self.log_date_time_string(),
                                               format % args))
 
@@ -80,12 +80,10 @@
         env['SERVER_PORT'] = str(self.server.server_port)
         env['REQUEST_URI'] = self.path
         env['PATH_INFO'] = path_info
+        env['REMOTE_HOST'] = self.client_address[0]
+        env['REMOTE_ADDR'] = self.client_address[0]
         if query:
             env['QUERY_STRING'] = query
-        host = self.address_string()
-        if host != self.client_address[0]:
-            env['REMOTE_HOST'] = host
-            env['REMOTE_ADDR'] = self.client_address[0]
 
         if self.headers.typeheader is None:
             env['CONTENT_TYPE'] = self.headers.type