If server runs on port 80 or 443 the default value of window.location.port is an empty string Signed-off-by: Jordan Pittier <jordan.pittier-ext@xxxxxxxxxxxxx> --- spice_auto.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spice_auto.html b/spice_auto.html index 81ec8cf..3c853bc 100644 --- a/spice_auto.html +++ b/spice_auto.html @@ -85,7 +85,19 @@ // By default, use the host and port of server that served this file host = spice_query_var('host', window.location.hostname); - port = spice_query_var('port', window.location.port); + var default_port = window.location.port; + + // if this page is served by a server listening + // on port 80 or 443, default_port is an empty string + if (!default_port) { + if (window.location.protocol == 'http:') { + default_port = 80; + } + else if (window.location.protocol == 'https:') { + default_port = 443; + } + } + port = spice_query_var('port', default_port); // If a token variable is passed in, set the parameter in a cookie. // This is used by nova-spiceproxy. -- 1.7.10.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel