changeset 4359:80d3f6f0d8e5

hg serve: don't do DNS lookups
author Matt Mackall <mpm@selenic.com>
date Wed, 25 Apr 2007 13:35:18 -0500
parents 11dc22eb8e8d
children 80c7fa620a4d c04c96504a12 d1dd16256114
files mercurial/hgweb/server.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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