[tbb-commits] [Git][tpo/applications/android-components][android-components-95.0.10-11.5-1] Bug 40070: Temporarily redirect DW's v2 address to their new v3 address
Matthew Finkel (@sysrqb)
gitlab at torproject.org
Fri Dec 17 16:24:01 UTC 2021
Matthew Finkel pushed to branch android-components-95.0.10-11.5-1 at The Tor Project / Applications / android-components
Commits:
8129e287 by Matthew Finkel at 2021-12-17T16:23:48+00:00
Bug 40070: Temporarily redirect DW's v2 address to their new v3 address
- - - - -
1 changed file:
- components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt
Changes:
=====================================
components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt
=====================================
@@ -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) {
@@ -1108,6 +1124,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.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/commit/8129e287206776a1387656a1b9718ec94cc91361
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/commit/8129e287206776a1387656a1b9718ec94cc91361
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20211217/5f90b348/attachment-0001.htm>
More information about the tbb-commits
mailing list