Skip to content
Snippets Groups Projects
Unverified Commit 8267cb25 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug 40070: Temporarily redirect DW's v2 address to their new v3 address

parent 710d1e60
No related branches found
No related tags found
1 merge request!77Bug 40070: Temporarily redirect DW's v2 address to their new v3 address
......@@ -155,12 +155,28 @@ class GeckoEngineSession(
return
}
// Bug 40070: Temporarily redirect DW's v2 address to their new v3 address
val currentHost = Uri.parse(url).host
logger.error("loadUrl: url: " + url)
logger.error("loadUrl: URL hostname: " + currentHost)
logger.error("loadUrl: V2_DW hostname: " + V2_DW_ADDRESS)
val newUrl = if (currentHost != null && currentHost.endsWith(V2_DW_ADDRESS)) {
logger.error("loadUrl: Found DW v2 address")
val newHost = currentHost.replace(V2_DW_ADDRESS, V3_DW_ADDRESS)
url.replaceFirst(currentHost, newHost)
} else {
url
}
logger.error("loadUrl: new url: " + newUrl)
if (initialLoad) {
initialLoadRequest = LoadRequest(url, parent, flags, additionalHeaders)
initialLoadRequest = LoadRequest(newUrl, parent, flags, additionalHeaders)
}
val loader = GeckoSession.Loader()
.uri(url)
.uri(newUrl)
.flags(flags.value)
if (additionalHeaders != null) {
......@@ -1092,6 +1108,8 @@ class GeckoEngineSession(
internal const val MOZ_NULL_PRINCIPAL = "moz-nullprincipal:"
internal const val ABOUT_BLANK = "about:blank"
internal val BLOCKED_SCHEMES = listOf("content", "file", "resource") // See 1684761 and 1684947
internal const val V2_DW_ADDRESS = "dwnewsvdyyiamwnp.onion"
internal const val V3_DW_ADDRESS = "dwnewsgngmhlplxy6o2twtfgjnrnjxbegbwqx6wnotdhkzt562tszfid.onion"
/**
* Provides an ErrorType corresponding to the error code provided.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment