Ticket #1908: webui.listenaddress.patch

File webui.listenaddress.patch, 3.3 KB (added by friedrichg2, 11 years ago)
  • deluge/ui/web/server.py

    diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py
    index 072de51..3e8504b 100644
    a b  
    8080 
    8181    # Server Settings 
    8282    "base": "/", 
     83    "listen_address": "0.0.0.0", 
    8384    "port": 8112, 
    8485    "https": False, 
    8586    "pkey": "ssl/daemon.pkey", 
    def __init__(self): 
    607608        self.socket = None 
    608609        self.top_level = TopLevel() 
    609610        self.site = server.Site(self.top_level) 
     611        self.listen_address = self.config["listen_address"] 
    610612        self.port = self.config["port"] 
    611613        self.https = self.config["https"] 
    612614        self.pkey = self.config["pkey"] 
    def start(self, start_reactor=True): 
    649651            reactor.run() 
    650652 
    651653    def start_normal(self): 
    652         self.socket = reactor.listenTCP(self.port, self.site) 
    653         log.info("serving on %s:%s view at http://127.0.0.1:%s", "0.0.0.0", 
    654                  self.port, self.port) 
     654        self.socket = reactor.listenTCP(self.port, self.site,  
     655                 interface=self.listen_address) 
     656        log.info("serving on %s:%s view at http://%s:%s", self.listen_address, 
     657                 self.port, self.listen_address, self.port) 
    655658 
    656659    def start_ssl(self): 
    657660        check_ssl_keys() 
    658         self.socket = reactor.listenSSL(self.port, self.site, ServerContextFactory()) 
    659         log.info("serving on %s:%s view at https://127.0.0.1:%s", "0.0.0.0", 
    660                  self.port, self.port) 
     661        self.socket = reactor.listenSSL(self.port, self.site, ServerContextFactory(),  
     662                 interface=self.listen_address) 
     663        log.info("serving on %s:%s view at https://%s:%s", self.listen_address, 
     664                 self.port, self.listen_address, self.port) 
    661665 
    662666    def stop(self): 
    663667        log.info("Shutting down webserver") 
  • deluge/ui/web/web.py

    diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py
    index fb440b9..a1661d4 100644
    a b def __init__(self): 
    7171            group.add_option("-g", "--group", dest="group", type="str", 
    7272                help="Group to switch to. Only use it when starting as root", 
    7373                action="store", default=None) 
     74        group.add_option("-a", "--listen-address", dest="listen_address", 
     75            type="str", help="Binds the webserver to a specific IP address", 
     76            action="store", default=None)  
    7477        group.add_option("-p", "--port", dest="port", type="int", 
    7578            help="Sets the port to be used for the webserver", 
    7679            action="store", default=None) 
    def start(self): 
    135138        if self.options.base: 
    136139            self.server.base = self.options.base 
    137140 
     141        if self.options.listen_address: 
     142            self.server.listen_address = self.options.listen_address 
     143 
    138144        if self.options.port: 
    139145            self.server.port = self.options.port 
    140146 
  • docs/man/deluge-web.1

    diff --git a/docs/man/deluge-web.1 b/docs/man/deluge-web.1
    index b3d861c..8084e3d 100644
    a b Set the base path that the ui is running on (proxying) 
    2222.B -f, --fork 
    2323Fork the web interface process into the background 
    2424.TP 
     25.B -a IP_ADDRESS, --listen-address=IP_ADDRESS 
     26Binds the webserver to a specific IP address 
     27.TP 
    2528.B -p PORT, --port=PORT 
    2629Sets the port to be used for the webserver 
    2730.TP