Corretto typo e aggiunte opzioni per porta e host.

Leonardo [2010-05-20 06:55]
Corretto typo e aggiunte opzioni per porta e host.
Filename
pywhois.py
pywhoisd.py
diff --git a/pywhois.py b/pywhois.py
index 8d08f59..11f8417 100644
--- a/pywhois.py
+++ b/pywhois.py
@@ -79,7 +79,7 @@ class WhoisRequestHandler(SocketServer.StreamRequestHandler):

     def handle(self):
         # Come prima cosa salutiamo
-        hello = self.server.config['welcome_message']
+        hello = self.server.config['welcome_banner']
         if hello:
             response = FormatMessage(hello)
         else:
diff --git a/pywhoisd.py b/pywhoisd.py
index 41672e5..a51add4 100755
--- a/pywhoisd.py
+++ b/pywhoisd.py
@@ -16,6 +16,10 @@ if __name__ == "__main__":
     parser.add_option("-c", "--config", dest="config_file",
                       default="pywhoisd.conf",
                       help = "Set config file", metavar="CONFIG_FILE")
+    parser.add_option("-p", "--port", dest="port",
+                      help = "The listening port of the daemon", default = "43")
+    parser.add_option("-l", "--listen", help="The listening address of the daemon",
+                      default = "0.0.0.0", dest="host")

     (options, args) = parser.parse_args()

@@ -25,7 +29,7 @@ if __name__ == "__main__":
     logger = pywhois.Logger(options.verbose)

     # Prepare the real server, listening to the whole world
-    host, port = "0.0.0.0", 43
+    host, port = options.host, int(options.port)
     server = pywhois.WhoisServer((host, port), logger, config)
     try:
         server.serve_forever()
ViewGit