Browse Source

Add option to suppress listening on web host address ::1

tags/0.7.1RC3
shypike 13 years ago
parent
commit
79488c4785
  1. 10
      SABnzbd.py
  2. 1
      sabnzbd/cfg.py
  3. 2
      sabnzbd/interface.py

10
SABnzbd.py

@ -253,6 +253,7 @@ def print_help():
print " --log-all Log all article handling (for developers)" print " --log-all Log all article handling (for developers)"
print " --console Force console logging for OSX app" print " --console Force console logging for OSX app"
print " --new Run a new instance of SABnzbd" print " --new Run a new instance of SABnzbd"
print " --no_ipv6 Do listen on IPv6 address [::1]"
def print_version(): def print_version():
print """ print """
@ -675,6 +676,7 @@ def get_webhost(cherryhost, cherryport, https_port):
def attach_server(host, port, cert=None, key=None): def attach_server(host, port, cert=None, key=None):
""" Define and attach server, optionally HTTPS """ Define and attach server, optionally HTTPS
""" """
if not (sabnzbd.cfg.no_ipv6() and '::1' in host):
http_server = _cpwsgi_server.CPWSGIServer() http_server = _cpwsgi_server.CPWSGIServer()
http_server.bind_addr = (host, port) http_server.bind_addr = (host, port)
if cert and key: if cert and key:
@ -841,7 +843,7 @@ def commandline_handler(frozen=True):
try: try:
opts, args = getopt.getopt(info, "phdvncw:l:s:f:t:b:2:", opts, args = getopt.getopt(info, "phdvncw:l:s:f:t:b:2:",
['pause', 'help', 'daemon', 'nobrowser', 'clean', 'logging=', ['pause', 'help', 'daemon', 'nobrowser', 'clean', 'logging=',
'weblogging=', 'server=', 'templates', 'weblogging=', 'server=', 'templates', 'no_ipv6',
'template2', 'browser=', 'config-file=', 'force', 'template2', 'browser=', 'config-file=', 'force',
'version', 'https=', 'autorestarted', 'repair', 'repair-all', 'version', 'https=', 'autorestarted', 'repair', 'repair-all',
'log-all', 'no-login', 'pid=', 'new', 'sessions', 'console', 'log-all', 'no-login', 'pid=', 'new', 'sessions', 'console',
@ -919,6 +921,7 @@ def main():
new_instance = False new_instance = False
force_sessions = False force_sessions = False
osx_console = False osx_console = False
no_ipv6 = False
service, sab_opts, serv_opts, upload_nzbs = commandline_handler() service, sab_opts, serv_opts, upload_nzbs = commandline_handler()
@ -1005,6 +1008,8 @@ def main():
elif opt in ('--console',): elif opt in ('--console',):
re_argv.append(opt) re_argv.append(opt)
osx_console = True osx_console = True
elif opt in ('--no_ipv6',):
no_ipv6 = True
sabnzbd.MY_FULLNAME = os.path.normpath(os.path.abspath(sabnzbd.MY_FULLNAME)) sabnzbd.MY_FULLNAME = os.path.normpath(os.path.abspath(sabnzbd.MY_FULLNAME))
sabnzbd.MY_NAME = os.path.basename(sabnzbd.MY_FULLNAME) sabnzbd.MY_NAME = os.path.basename(sabnzbd.MY_FULLNAME)
@ -1087,6 +1092,9 @@ def main():
# Set root folders for HTTPS server file paths # Set root folders for HTTPS server file paths
sabnzbd.cfg.set_root_folders2() sabnzbd.cfg.set_root_folders2()
if no_ipv6:
sabnzbd.cfg.no_ipv6.set(True)
# Determine web host address # Determine web host address
cherryhost, cherryport, browserhost, https_port = get_webhost(cherryhost, cherryport, https_port) cherryhost, cherryport, browserhost, https_port = get_webhost(cherryhost, cherryport, https_port)
enable_https = sabnzbd.cfg.enable_https() enable_https = sabnzbd.cfg.enable_https()

1
sabnzbd/cfg.py

@ -221,6 +221,7 @@ api_warnings = OptionBool('misc', 'api_warnings', True)
max_art_tries = OptionNumber('misc', 'max_art_tries', 3, 2) max_art_tries = OptionNumber('misc', 'max_art_tries', 3, 2)
max_art_opt = OptionBool('misc', 'max_art_opt', False) max_art_opt = OptionBool('misc', 'max_art_opt', False)
use_pickle = OptionBool('misc', 'use_pickle', False) use_pickle = OptionBool('misc', 'use_pickle', False)
no_ipv6 = OptionBool('misc', 'no_ipv6', False)
growl_server = OptionStr('growl', 'growl_server') growl_server = OptionStr('growl', 'growl_server')
growl_password = OptionPassword('growl', 'growl_password') growl_password = OptionPassword('growl', 'growl_password')

2
sabnzbd/interface.py

@ -1188,7 +1188,7 @@ SPECIAL_BOOL_LIST = \
'queue_complete_pers', 'api_warnings', 'allow_64bit_tools', 'par2_multicore', 'queue_complete_pers', 'api_warnings', 'allow_64bit_tools', 'par2_multicore',
'never_repair', 'allow_streaming', 'ignore_unrar_dates', 'rss_filenames', 'never_repair', 'allow_streaming', 'ignore_unrar_dates', 'rss_filenames',
'osx_menu', 'osx_speed', 'win_menu', 'uniconfig', 'use_pickle', 'allow_incomplete_nzb', 'osx_menu', 'osx_speed', 'win_menu', 'uniconfig', 'use_pickle', 'allow_incomplete_nzb',
'random_server_ip' 'random_server_ip', 'no_ipv6'
) )
SPECIAL_VALUE_LIST = \ SPECIAL_VALUE_LIST = \
( 'size_limit', 'folder_max_length', 'fsys_type', 'movie_rename_limit', 'nomedia_marker', ( 'size_limit', 'folder_max_length', 'fsys_type', 'movie_rename_limit', 'nomedia_marker',

Loading…
Cancel
Save