Skip to content

Commit

Permalink
HostIlE - IE11 connects to a wrong host in cross domain scenarios whe…
Browse files Browse the repository at this point in the history
…n a relative connection url is used (fixes SignalR#2959)

When parsing a relatinve uri with <a /> (anchor) IE11 does not provide the protocol so we fall back to using `window.document.location` to resolve connection details. However if the host could be read from the url provided by the user we should use it instead of the one from the `window.document.location`. The fix is to use the host from the url provided by the user if possible and fall back to using the host from the `window.document.location` if the host could not be read from the user's url.
  • Loading branch information
moozzyk committed May 1, 2014
1 parent 594efa3 commit 40334a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Microsoft.AspNet.SignalR.Client.JS/jquery.signalR.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,14 @@
parser.href = connection.url;
if (!parser.protocol || parser.protocol === ":") {
connection.protocol = window.document.location.protocol;
connection.host = window.document.location.host;
connection.baseUrl = connection.protocol + "//" + connection.host;
connection.host = parser.host || window.document.location.host;
} else {
connection.protocol = parser.protocol;
connection.host = parser.host;
connection.baseUrl = parser.protocol + "//" + parser.host;
}

connection.baseUrl = connection.protocol + "//" + connection.host;

// Set the websocket protocol
connection.wsProtocol = connection.protocol === "https:" ? "wss://" : "ws://";

Expand Down

0 comments on commit 40334a7

Please sign in to comment.