diff --git a/addons/hw_screen/controllers/main.py b/addons/hw_screen/controllers/main.py index 565bdbe02a3..b8e59fbfdd6 100644 --- a/addons/hw_screen/controllers/main.py +++ b/addons/hw_screen/controllers/main.py @@ -13,7 +13,7 @@ from subprocess import call import time import threading -self_port = str(config['xmlrpc_port'] or 8069) +self_port = str(config['http_port'] or 8069) _logger = logging.getLogger(__name__) diff --git a/doc/reference/cmdline.rst b/doc/reference/cmdline.rst index 37b0e9db646..d35868a718f 100644 --- a/doc/reference/cmdline.rst +++ b/doc/reference/cmdline.rst @@ -177,7 +177,7 @@ database built-in HTTP ------------- -.. option:: --no-xmlrpc +.. option:: --no-http do not start the HTTP or long-polling workers (may still start cron workers) @@ -185,12 +185,12 @@ built-in HTTP .. warning:: has no effect if :option:`--test-enable` is set, as tests require an accessible HTTP server -.. option:: --xmlrpc-interface +.. option:: --http-interface TCP/IP address on which the HTTP server listens, defaults to ``0.0.0.0`` (all addresses) -.. option:: --xmlrpc-port +.. option:: --http-port Port on which the HTTP server listens, defaults to 8069. @@ -375,7 +375,7 @@ and other ``-`` are replaced by ``_`` e.g. :option:`--db-template` becomes Some conversions don't match the pattern: * :option:`--db-filter` becomes ``dbfilter`` -* :option:`--no-xmlrpc` corresponds to the ``xmlrpc`` boolean +* :option:`--no-http` corresponds to the ``http_enable`` boolean * logging presets (all options starting with ``--log-`` except for :option:`--log-handler` and :option:`--log-db`) just add content to ``log_handler``, use that directly in the configuration file diff --git a/doc/setup/deploy.rst b/doc/setup/deploy.rst index 983a2318117..9879117b607 100644 --- a/doc/setup/deploy.rst +++ b/doc/setup/deploy.rst @@ -211,7 +211,7 @@ the client will not connect to it. Instead you must have a proxy redirecting requests whose URL starts with ``/longpolling/`` to the longpolling port. Other request should be proxied to -the :option:`normal HTTP port ` +the :option:`normal HTTP port ` .. warning:: The livechat worker requires the ``psycogreen`` Python module, which is not always included with all installation packages. @@ -357,7 +357,7 @@ To run cron jobs for an Odoo deployment as a WSGI application requires :option:`odoo-bin -d`) * which should not be exposed to the network. To ensure cron runners are not network-accessible, it is possible to disable the built-in HTTP server - entirely with :option:`odoo-bin --no-xmlrpc` or setting ``xmlrpc = False`` + entirely with :option:`odoo-bin --no-http` or setting ``http_enable = False`` in the configuration file LiveChat diff --git a/odoo/addons/base/ir/ir_config_parameter.py b/odoo/addons/base/ir/ir_config_parameter.py index a286a8836ce..bb9d3e9fbcc 100644 --- a/odoo/addons/base/ir/ir_config_parameter.py +++ b/odoo/addons/base/ir/ir_config_parameter.py @@ -19,7 +19,7 @@ _default_parameters = { "database.secret": lambda: pycompat.text_type(uuid.uuid4()), "database.uuid": lambda: pycompat.text_type(uuid.uuid1()), "database.create_date": fields.Datetime.now, - "web.base.url": lambda: "http://localhost:%s" % config.get('xmlrpc_port'), + "web.base.url": lambda: "http://localhost:%s" % config.get('http_port'), } diff --git a/odoo/service/server.py b/odoo/service/server.py index de959cc31da..87157a32a5d 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -157,11 +157,10 @@ class FSWatcher(object): class CommonServer(object): def __init__(self, app): - # TODO Change the xmlrpc_* options to http_* self.app = app # config - self.interface = config['xmlrpc_interface'] or '0.0.0.0' - self.port = config['xmlrpc_port'] + self.interface = config['http_interface'] or '0.0.0.0' + self.port = config['http_port'] # runtime self.pid = os.getpid() @@ -276,7 +275,7 @@ class ThreadedServer(CommonServer): win32api.SetConsoleCtrlHandler(lambda sig: self.signal_handler(sig, None), 1) test_mode = config['test_enable'] or config['test_file'] - if test_mode or (config['xmlrpc'] and not stop): + if test_mode or (config['http_enable'] and not stop): # some tests need the http deamon to be available... self.http_spawn() @@ -402,8 +401,8 @@ class PreforkServer(CommonServer): """ def __init__(self, app): # config - self.address = config['xmlrpc'] and \ - (config['xmlrpc_interface'] or '0.0.0.0', config['xmlrpc_port']) + self.address = config['http_enable'] and \ + (config['http_interface'] or '0.0.0.0', config['http_port']) self.population = config['workers'] self.timeout = config['limit_time_real'] self.limit_request = config['limit_request'] @@ -537,7 +536,7 @@ class PreforkServer(CommonServer): self.worker_kill(pid, signal.SIGKILL) def process_spawn(self): - if config['xmlrpc']: + if config['http_enable']: while len(self.workers_http) < self.population: self.worker_spawn(WorkerHTTP, self.workers_http) if not self.long_polling_pid: diff --git a/odoo/tests/common.py b/odoo/tests/common.py index cf1c664d229..4d1ddac5c73 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -43,7 +43,7 @@ _logger = logging.getLogger(__name__) # The odoo library is supposed already configured. ADDONS_PATH = odoo.tools.config['addons_path'] HOST = '127.0.0.1' -PORT = odoo.tools.config['xmlrpc_port'] +PORT = odoo.tools.config['http_port'] # Useless constant, tests are aware of the content of demo data ADMIN_USER_ID = odoo.SUPERUSER_ID diff --git a/odoo/tools/config.py b/odoo/tools/config.py index b158c2e17f0..25d62ef0cf7 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -58,7 +58,6 @@ def _deduplicate_loggers(loggers): for logger, level in dict(it.split(':') for it in loggers).items() ) - class configmanager(object): def __init__(self, fname=None): """Constructor. @@ -120,24 +119,33 @@ class configmanager(object): help="Directory where to store Odoo data") parser.add_option_group(group) - # XML-RPC / HTTP - group = optparse.OptionGroup(parser, "XML-RPC Configuration") - group.add_option("--xmlrpc-interface", dest="xmlrpc_interface", my_default='', - help="Specify the TCP IP address for the XML-RPC protocol. The empty string binds to all interfaces.") - group.add_option("--xmlrpc-port", dest="xmlrpc_port", my_default=8069, - help="specify the TCP port for the XML-RPC protocol", type="int") - group.add_option("--no-xmlrpc", dest="xmlrpc", action="store_false", my_default=True, - help="disable the XML-RPC protocol") - group.add_option("--proxy-mode", dest="proxy_mode", action="store_true", my_default=False, - help="Enable correct behavior when behind a reverse proxy") + # HTTP + group = optparse.OptionGroup(parser, "HTTP Service Configuration") + group.add_option("--http-interface", dest="http_interface", my_default='', + help="Listen interface address for HTTP services. " + "Keep empty to listen on all interfaces (0.0.0.0)") + group.add_option("-p", "--http-port", dest="http_port", my_default=8069, + help="Listen port for the main HTTP service", type="int", metavar="PORT") group.add_option("--longpolling-port", dest="longpolling_port", my_default=8072, - help="specify the TCP port for longpolling requests", type="int") + help="Listen port for the longpolling HTTP service", type="int", metavar="PORT") + group.add_option("--no-http", dest="http_enable", action="store_false", my_default=True, + help="Disable the HTTP and Longpolling services entirely") + group.add_option("--proxy-mode", dest="proxy_mode", action="store_true", my_default=False, + help="Activate reverse proxy WSGI wrappers (headers rewriting) " + "Only enable this when running behind a trusted web proxy!") + # HTTP: hidden backwards-compatibility for "*xmlrpc*" options + hidden = optparse.SUPPRESS_HELP + group.add_option("--xmlrpc-interface", dest="http_interface", help=hidden) + group.add_option("--xmlrpc-port", dest="http_port", type="int", help=hidden) + group.add_option("--no-xmlrpc", dest="http_enable", action="store_false", help=hidden) + parser.add_option_group(group) # WEB group = optparse.OptionGroup(parser, "Web interface Configuration") - group.add_option("--db-filter", dest="dbfilter", my_default='', - help="Filter listed database", metavar="REGEXP") + group.add_option("--db-filter", dest="dbfilter", my_default='', metavar="REGEXP", + help="Regular expressions for filtering available databases for Web UI. " + "The expression can use %d (domain) and %h (host) placeholders.") parser.add_option_group(group) # Testing Group @@ -383,12 +391,12 @@ class configmanager(object): self.options['server_wide_modules'] = 'web' # if defined dont take the configfile value even if the defined value is None - keys = ['xmlrpc_interface', 'xmlrpc_port', 'longpolling_port', + keys = ['http_interface', 'http_port', 'longpolling_port', 'http_enable', 'db_name', 'db_user', 'db_password', 'db_host', 'db_sslmode', 'db_port', 'db_template', 'logfile', 'pidfile', 'smtp_port', 'email_from', 'smtp_server', 'smtp_user', 'smtp_password', 'db_maxconn', 'import_partial', 'addons_path', - 'xmlrpc', 'syslog', 'without_demo', + 'syslog', 'without_demo', 'dbfilter', 'log_level', 'log_db', 'log_db_level', 'geoip_database', 'dev_mode', 'shell_interface' ] @@ -410,7 +418,7 @@ class configmanager(object): keys = [ 'language', 'translate_out', 'translate_in', 'overwrite_existing_translations', 'dev_mode', 'shell_interface', 'smtp_ssl', 'load_language', - 'stop_after_init', 'logrotate', 'without_demo', 'xmlrpc', 'syslog', + 'stop_after_init', 'logrotate', 'without_demo', 'http_enable', 'syslog', 'list_db', 'proxy_mode', 'test_file', 'test_enable', 'test_commit', 'test_report_directory', 'osv_memory_count_limit', 'osv_memory_age_limit', 'max_cron_threads', 'unaccent', @@ -503,10 +511,16 @@ class configmanager(object): setattr(parser.values, option.dest, ",".join(ad_paths)) def load(self): + outdated_options_map = { + 'xmlrpc_port': 'http_port', + 'xmlrpc_interface': 'http_interface', + 'xmlrpc': 'http_enable', + } p = ConfigParser.RawConfigParser() try: p.read([self.rcfile]) for (name,value) in p.items('options'): + name = outdated_options_map.get(name, name) if value=='True' or value=='true': value = True if value=='False' or value=='false':