With netaddr.valid_ipv4/6, empty host is not allowed and will fail
to validate.
This patch changes to the default wsgi listen host to "0.0.0.0"
and enable to validate it by using netaddr.

Note: The default behavior is NOT changed.

Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com>
---
 ryu/app/wsgi.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py
index fc4c71a..0b98df9 100644
--- a/ryu/app/wsgi.py
+++ b/ryu/app/wsgi.py
@@ -34,11 +34,17 @@ from webob.response import Response as webob_Response
 from ryu import cfg
 from ryu.lib import hub
 
+DEFAULT_WSGI_HOST = '0.0.0.0'
+DEFAULT_WSGI_PORT = 8080
 
 CONF = cfg.CONF
 CONF.register_cli_opts([
-    cfg.StrOpt('wsapi-host', default='', help='webapp listen host'),
-    cfg.IntOpt('wsapi-port', default=8080, help='webapp listen port')
+    cfg.StrOpt(
+        'wsapi-host', default=DEFAULT_WSGI_HOST,
+        help='webapp listen host (default %s)' % DEFAULT_WSGI_HOST),
+    cfg.IntOpt(
+        'wsapi-port', default=DEFAULT_WSGI_PORT,
+        help='webapp listen port (default %s)' % DEFAULT_WSGI_PORT),
 ])
 
 HEX_PATTERN = r'0x[0-9a-z]+'
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to