Commit d888bb25 authored by Glenn Adams's avatar Glenn Adams

Update https, tls, wsp configuration.

parent bde60396
"use strict";
function run(t) {
var defProperties = t.properties.def;
var url = './support/respond.py';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = t.step_func_done(function() {
// test original request headers (returned unmodified by responder)
var response = JSON.parse(xhr.response);
test(function() {
assert_true('accept' in response);
}, defProperties.expandedName + '-test-request-header-accept-present');
test(function() {
assert_true('accept-language' in response);
}, defProperties.expandedName + '-test-request-header-accept-language-present');
test(function() {
assert_true('accept-encoding' in response);
}, defProperties.expandedName + '-test-request-header-accept-encoding-present');
test(function() {
assert_true('connection' in response);
}, defProperties.expandedName + '-test-request-header-connection-present');
test(function() {
assert_equals(response['connection'], 'keep-alive');
}, defProperties.expandedName + '-test-request-header-connection-has-keep-alive');
test(function() {
assert_true('host' in response);
}, defProperties.expandedName + '-test-request-header-host-present');
test(function() {
assert_equals(response['host'], location.host);
}, defProperties.expandedName + '-test-request-header-host-match');
test(function() {
assert_true('referer' in response);
}, defProperties.expandedName + '-test-request-header-referer-present');
test(function() {
assert_equals(response['referer'], location.href);
}, defProperties.expandedName + '-test-request-header-referer-match');
test(function() {
assert_true('user-agent' in response);
}, defProperties.expandedName + '-test-request-header-user-agent-present');
// test response headers (returned by responder)
var responseHeaders = getResponseHeaders(xhr);
test(function() {
assert_true('content-length' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-content-length-present');
test(function() {
assert_true('content-type' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-content-type-present');
test(function() {
assert_equals(responseHeaders['content-type'], 'application/json');
}, defProperties.expandedName + '-test-response-header-content-type-match');
test(function() {
assert_true('date' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-date-present');
test(function() {
assert_true('server' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-server-present');
});
xhr.onerror = function() {
assert_unreached('unable to load ' + url);
};
xhr.send();
}
function getResponseHeaders(xhr) {
var headers = xhr.getAllResponseHeaders().split('\u000d\u000a');
var responseHeaders = {};
for (var i = 0; i < headers.length; ++i) {
var header = headers[i];
if (header.indexOf(':') >= 0) {
var headerComponents = header.split(':');
var n = headerComponents[0];
var v = headerComponents[1];
responseHeaders[n.toLowerCase().trim()] = v.trim();
}
}
return responseHeaders;
}
{
"spec": "https",
"source": "http://tools.ietf.org/rfc/rfc5785.txt",
"source": "http://tools.ietf.org/rfc/rfc2616.txt",
"levels": [ 3 ],
"local": "rfc5785.txt",
"local": "rfc2616.txt",
"dontFetch": true,
"dontFetchReason": "specification is final",
"comments": "can't test yet due to missing tls support in wptserve",
"helpers3": []
}
import json
def main(request, response):
response.headers.set("Content-Type", "application/json")
return json.dumps(request.headers)
This diff is collapsed.
......@@ -5,5 +5,6 @@
"local": "rfc5246.txt",
"dontFetch": true,
"dontFetchReason": "specification is final",
"comments": "can't test yet due to missing tls support in wptserve",
"helpers3": []
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,5 +5,16 @@
"local": "rfc6455.txt",
"dontFetch": true,
"dontFetchReason": "specification is final",
"helpers3": []
"comments": "can't test 'wss' scheme yet due to missing tls support in pywebsocket",
"helpers3": [
"SchemeWS"
],
"tests": [
{
"name": "SchemeWS",
"helper": "SchemeWS",
"code": "run(t)",
"async": true
}
]
}
"use strict";
function run(t) {
var defProperties = t.properties.def;
var url = './support/respond.py';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = t.step_func_done(function() {
// test original request headers (returned unmodified by responder)
var response = JSON.parse(xhr.response);
test(function() {
assert_true('accept' in response);
}, defProperties.expandedName + '-test-request-header-accept-present');
test(function() {
assert_true('accept-language' in response);
}, defProperties.expandedName + '-test-request-header-accept-language-present');
test(function() {
assert_true('accept-encoding' in response);
}, defProperties.expandedName + '-test-request-header-accept-encoding-present');
test(function() {
assert_true('connection' in response);
}, defProperties.expandedName + '-test-request-header-connection-present');
test(function() {
assert_equals(response['connection'], 'keep-alive');
}, defProperties.expandedName + '-test-request-header-connection-has-keep-alive');
test(function() {
assert_true('host' in response);
}, defProperties.expandedName + '-test-request-header-host-present');
test(function() {
assert_equals(response['host'], location.host);
}, defProperties.expandedName + '-test-request-header-host-match');
test(function() {
assert_true('referer' in response);
}, defProperties.expandedName + '-test-request-header-referer-present');
test(function() {
assert_equals(response['referer'], location.href);
}, defProperties.expandedName + '-test-request-header-referer-match');
test(function() {
assert_true('user-agent' in response);
}, defProperties.expandedName + '-test-request-header-user-agent-present');
// test response headers (returned by responder)
var responseHeaders = getResponseHeaders(xhr);
test(function() {
assert_true('content-length' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-content-length-present');
test(function() {
assert_true('content-type' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-content-type-present');
test(function() {
assert_equals(responseHeaders['content-type'], 'application/json');
}, defProperties.expandedName + '-test-response-header-content-type-match');
test(function() {
assert_true('date' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-date-present');
test(function() {
assert_true('server' in responseHeaders);
}, defProperties.expandedName + '-test-response-header-server-present');
});
xhr.onerror = function() {
assert_unreached('unable to load ' + url);
};
xhr.send();
}
function getResponseHeaders(xhr) {
var headers = xhr.getAllResponseHeaders().split('\u000d\u000a');
var responseHeaders = {};
for (var i = 0; i < headers.length; ++i) {
var header = headers[i];
if (header.indexOf(':') >= 0) {
var headerComponents = header.split(':');
var n = headerComponents[0];
var v = headerComponents[1];
responseHeaders[n.toLowerCase().trim()] = v.trim();
}
}
return responseHeaders;
}
import json
def main(request, response):
response.headers.set("Content-Type", "application/json")
return json.dumps(request.headers)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment