Commit b7b7c793 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Automatic upgrade upgrade to HTTPS on failure

parent 1961cbe7623a
......@@ -299,6 +299,20 @@ export function getResourceContent(
let xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 0 && uri.startsWith("http://")) {
// try https
getResourceContent(cache, {
location: ViewResourceLocation.remote,
uri: "https:" + uri.substring("http:".length)
} as ViewResourceRemote)
.then((result: string) => {
resolve(result);
})
.catch((reason: any) => {
reject("Failed to fetch: " + reason);
});
return;
}
if (xmlHttp.status < 200 || xmlHttp.status >= 300) {
reject("HTTP error: " + xmlHttp.status);
return;
......
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