Index: net/data/websocket/connect_to.html |
diff --git a/net/data/websocket/connect_check.html b/net/data/websocket/connect_to.html |
similarity index 56% |
copy from net/data/websocket/connect_check.html |
copy to net/data/websocket/connect_to.html |
index 4a1ca8c5dfc0b7cb86b86f019a3a4038db867f35..05c653fc5d2ab9a333efea5b4c5eee83a03bbe07 100644 |
--- a/net/data/websocket/connect_check.html |
+++ b/net/data/websocket/connect_to.html |
@@ -5,14 +5,13 @@ |
<script type="text/javascript"> |
var href = window.location.href; |
-var hostBegin = href.indexOf('/') + 2; |
-var hostEnd = href.lastIndexOf(':'); |
-var host = href.slice(hostBegin, hostEnd); |
-var portBegin = hostEnd + 1; |
-var portEnd = href.lastIndexOf('/'); |
-var port = href.slice(portBegin, portEnd); |
-var scheme = href.indexOf('https') >= 0 ? 'wss' : 'ws'; |
-var url = scheme + '://' + host + ':' + port + '/echo-with-no-extension'; |
+var queryBegin = href.indexOf('?url='); |
+if (queryBegin == -1) { |
+ console.log("Failed to find ?url= in URL"); |
+ document.title = 'FAIL'; |
+ throw "FAILURE"; |
+} |
+var url = href.slice(queryBegin + 5); |
// Do connection test. |
var ws = new WebSocket(url); |