mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset e393b9673207. ( Bug 573803 - add SSL WebSocket support to mochitest. r=ted )
This commit is contained in:
parent
ed48fbc343
commit
72e587294e
@ -388,24 +388,21 @@ function FindProxyForURL(url, host)
|
||||
return 'DIRECT';
|
||||
var isHttp = matches[1] == 'http';
|
||||
var isHttps = matches[1] == 'https';
|
||||
var isWs = matches[1] == 'ws';
|
||||
var isWss = matches[1] == 'wss';
|
||||
var isWebSocket = matches[1] == 'ws';
|
||||
if (!matches[3])
|
||||
{
|
||||
if (isHttp | isWs) matches[3] = '80';
|
||||
if (isHttps | isWss) matches[3] = '443';
|
||||
if (isHttp | isWebSocket) matches[3] = '80';
|
||||
if (isHttps) matches[3] = '443';
|
||||
}
|
||||
if (isWs)
|
||||
if (isWebSocket)
|
||||
matches[1] = 'http';
|
||||
if (isWss)
|
||||
matches[1] = 'https';
|
||||
|
||||
var origin = matches[1] + '://' + matches[2] + ':' + matches[3];
|
||||
if (origins.indexOf(origin) < 0)
|
||||
return 'DIRECT';
|
||||
if (isHttp)
|
||||
return 'PROXY %(remote)s:%(httpport)s';
|
||||
if (isHttps || isWs || isWss)
|
||||
if (isHttps || isWebSocket)
|
||||
return 'PROXY %(remote)s:%(sslport)s';
|
||||
return 'DIRECT';
|
||||
}""" % { "origins": origins,
|
||||
|
@ -396,7 +396,6 @@ _TEST_FILES2 = \
|
||||
test_bug571390.xul \
|
||||
test_bug300992.html \
|
||||
test_websocket_hello.html \
|
||||
test_websocket_ssl_hello.html \
|
||||
file_websocket_hello_wsh.py \
|
||||
test_ws_basic_tests.html \
|
||||
file_ws_basic_tests_wsh.py \
|
||||
|
@ -4,10 +4,7 @@ def web_socket_do_extra_handshake(request):
|
||||
pass
|
||||
|
||||
def web_socket_transfer_data(request):
|
||||
resp = "Fail"
|
||||
request_text = msgutil.receive_message(request)
|
||||
if request_text == "data":
|
||||
resp = "Test"
|
||||
if msgutil.receive_message(request) == "data":
|
||||
resp = "Hello world!"
|
||||
elif request_text == "ssltest":
|
||||
resp = "ssldata"
|
||||
msgutil.send_message(request, resp)
|
||||
|
@ -1,50 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
-->
|
||||
<head>
|
||||
<title>Basic websocket test</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="testWebSocket()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=472529">Mozilla Bug </a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var ws;
|
||||
|
||||
function testWebSocket () {
|
||||
ws = new WebSocket("wss://example.com:443/tests/content/base/test/file_websocket_hello");
|
||||
ws.onopen = function(e) {
|
||||
ws.send("ssltest");
|
||||
}
|
||||
ws.onclose = function(e) {
|
||||
}
|
||||
ws.onerror = function(e) {
|
||||
is(false, "onerror called!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
ws.onmessage = function(e) {
|
||||
is(e.data, "ssldata");
|
||||
ws.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
<div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -382,13 +382,13 @@ bool AdjustWebSocketLocation(relayBuffer& buffer, connection_info_t *ci)
|
||||
char* wsloc = strstr(buffer.bufferhead, "Sec-WebSocket-Location:");
|
||||
if (!wsloc)
|
||||
return true;
|
||||
// advance pointer to the start of the url, which will always start with
|
||||
// ws://, since pywebsocket is ignorant of whether SSL is being used or not
|
||||
// advance pointer to the start of the hostname
|
||||
wsloc = strstr(wsloc, "ws://");
|
||||
if (!wsloc)
|
||||
return false;
|
||||
wsloc += 5;
|
||||
// find the end of the hostname
|
||||
char* wslocend = strchr(wsloc + 5, '/');
|
||||
char* wslocend = strchr(wsloc + 1, '/');
|
||||
if (!wslocend)
|
||||
return false;
|
||||
char *crlf = strstr(wsloc, "\r\n");
|
||||
@ -397,17 +397,13 @@ bool AdjustWebSocketLocation(relayBuffer& buffer, connection_info_t *ci)
|
||||
if (ci->original_host.empty())
|
||||
return true;
|
||||
|
||||
// generate a new hostname, beginning either with ws:// or wss://,
|
||||
// as appropriate, depending on whether this connection is using SSL
|
||||
string newhost = (ci->http_proxy_only ? "ws://" : "wss://");
|
||||
newhost.append(ci->original_host);
|
||||
int diff = newhost.length() - (wslocend-wsloc);
|
||||
int diff = ci->original_host.length() - (wslocend-wsloc);
|
||||
if (diff > 0)
|
||||
assert(size_t(diff) <= buffer.margin());
|
||||
memmove(wslocend + diff, wslocend, buffer.buffertail - wsloc - diff);
|
||||
buffer.buffertail += diff;
|
||||
|
||||
memcpy(wsloc, newhost.c_str(), newhost.length());
|
||||
memcpy(wsloc, ci->original_host.c_str(), ci->original_host.length());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user