[tbb-commits] [tor-browser/tor-browser-91.4.0esr-11.0-1] Bug 40483: Temporarily redirect DW's v2 address to their new v3 address

sysrqb at torproject.org sysrqb at torproject.org
Thu Dec 2 23:12:05 UTC 2021


commit 3cb6f0402e83cb93fbd965977f00682608cdb1b8
Author: Matthew Finkel <sysrqb at torproject.org>
Date:   Mon Oct 4 22:45:56 2021 +0000

    Bug 40483: Temporarily redirect DW's v2 address to their new v3 address
---
 docshell/base/nsDocShell.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index f4557f3fff31..575be16abc3a 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5990,6 +5990,7 @@ already_AddRefed<nsIURI> nsDocShell::AttemptURIFixup(
     bool aNotifyKeywordSearchLoading, nsIInputStream** aNewPostData) {
   if (aStatus != NS_ERROR_UNKNOWN_HOST && aStatus != NS_ERROR_NET_RESET &&
       aStatus != NS_ERROR_CONNECTION_REFUSED &&
+      aStatus != NS_ERROR_TOR_ONION_SVC_BAD_ADDRESS &&
       aStatus !=
           mozilla::psm::GetXPCOMFromNSSError(SSL_ERROR_BAD_CERT_DOMAIN)) {
     return nullptr;
@@ -6137,6 +6138,18 @@ already_AddRefed<nsIURI> nsDocShell::AttemptURIFixup(
         }
       }
     }
+  } else if (aStatus == NS_ERROR_TOR_ONION_SVC_BAD_ADDRESS) {
+    // Bug 40483: Temporarily redirect DW's v2 address to their new v3 address
+    constexpr auto kV2DW = "dwnewsvdyyiamwnp.onion"_ns;
+    constexpr auto kV3DW = "dwnewsgngmhlplxy6o2twtfgjnrnjxbegbwqx6wnotdhkzt562tszfid.onion"_ns;
+    nsAutoCString host;
+    newURI = nullptr;
+    Unused << url->GetHost(host);
+    if (StringEndsWith(host, kV2DW)) {
+      auto& subdomains = Substring(host, 0, host.Length() - kV2DW.Length());
+      Unused << NS_MutateURI(url).SetHost(subdomains + kV3DW).Finalize(
+        getter_AddRefs(newURI));
+    }
   } else if (aStatus == NS_ERROR_CONNECTION_REFUSED &&
              Preferences::GetBool("browser.fixup.fallback-to-https", false)) {
     // Try HTTPS, since http didn't work



More information about the tbb-commits mailing list