1616#
1717""" HTTP Server that serves roundup.
1818
19- $Id: roundup_server.py,v 1.24 2003-05-09 02:02:40 richard Exp $
19+ $Id: roundup_server.py,v 1.25 2003-08-12 01:11:43 richard Exp $
2020"""
2121
2222# python version check
@@ -204,6 +204,13 @@ def inner_run_cgi(self):
204204 c = tracker .Client (tracker , self , env )
205205 c .main ()
206206
207+ LOG_IPADDRESS = 1
208+ def address_string (self ):
209+ if self .LOG_IPADDRESS :
210+ return self .client_address [0 ]
211+ else :
212+ host , port = self .client_address
213+ return socket .getfqdn (host )
207214
208215try :
209216 import win32serviceutil
@@ -301,16 +308,19 @@ def usage(message=''):
301308 if message :
302309 message = _ ('Error: %(error)s\n \n ' )% {'error' : message }
303310 print _ ('''%(message)sUsage:
304- roundup-server [-n hostname] [-p port] [-l file] [-d file ] [name=tracker home]*
311+ roundup-server [options ] [name=tracker home]*
305312
313+ options:
306314 -n: sets the host name
307315 -p: sets the port to listen on
308316 -l: sets a filename to log to (instead of stdout)
309317 -d: run the server in the background and on UN*X write the server's PID
310318 to the nominated file. Note: on Windows the PID argument is needed,
311319 but ignored.
320+ -N: log client machine names in access log instead of IP addresses (much
321+ slower)
312322
313- name=tracker home
323+ name=tracker home:
314324 Sets the tracker home(s) to use. The name is how the tracker is
315325 identified in the URL (it's the first part of the URL path). The
316326 tracker home is the directory that was identified when you did
@@ -381,7 +391,7 @@ def run():
381391 try :
382392 # handle the command-line args
383393 try :
384- optlist , args = getopt .getopt (sys .argv [1 :], 'n:p:u:d:l:h ' )
394+ optlist , args = getopt .getopt (sys .argv [1 :], 'n:p:u:d:l:hN ' )
385395 except getopt .GetoptError , e :
386396 usage (str (e ))
387397
@@ -393,6 +403,7 @@ def run():
393403 elif opt == '-d' : pidfile = abspath (arg )
394404 elif opt == '-l' : logfile = abspath (arg )
395405 elif opt == '-h' : usage ()
406+ elif opt == '-N' : RoundupRequestHandler .LOG_IPADDRESS = 0
396407
397408 if hasattr (os , 'getuid' ):
398409 # if root, setuid to the running user
0 commit comments