[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-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



Title: GitLab

Matthew Finkel pushed to branch android-components-95.0.10-11.5-1 at The Tor Project / Applications / android-components

Commits:

1 changed file:

Changes:

  • components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt
    ... ... @@ -155,12 +155,28 @@ class GeckoEngineSession(
    155 155
                 return
    
    156 156
             }
    
    157 157
     
    
    158
    +        // Bug 40070: Temporarily redirect DW's v2 address to their new v3 address
    
    159
    +        val currentHost = Uri.parse(url).host
    
    160
    +        logger.error("loadUrl: url: " + url)
    
    161
    +        logger.error("loadUrl: URL hostname: " + currentHost)
    
    162
    +        logger.error("loadUrl: V2_DW hostname: " + V2_DW_ADDRESS)
    
    163
    +
    
    164
    +        val newUrl = if (currentHost != null && currentHost.endsWith(V2_DW_ADDRESS)) {
    
    165
    +            logger.error("loadUrl: Found DW v2 address")
    
    166
    +            val newHost = currentHost.replace(V2_DW_ADDRESS, V3_DW_ADDRESS)
    
    167
    +            url.replaceFirst(currentHost, newHost)
    
    168
    +        } else {
    
    169
    +            url
    
    170
    +        }
    
    171
    +
    
    172
    +        logger.error("loadUrl: new url: " + newUrl)
    
    173
    +
    
    158 174
             if (initialLoad) {
    
    159
    -            initialLoadRequest = LoadRequest(url, parent, flags, additionalHeaders)
    
    175
    +            initialLoadRequest = LoadRequest(newUrl, parent, flags, additionalHeaders)
    
    160 176
             }
    
    161 177
     
    
    162 178
             val loader = GeckoSession.Loader()
    
    163
    -            .uri(url)
    
    179
    +            .uri(newUrl)
    
    164 180
                 .flags(flags.value)
    
    165 181
     
    
    166 182
             if (additionalHeaders != null) {
    
    ... ... @@ -1108,6 +1124,8 @@ class GeckoEngineSession(
    1108 1124
             internal const val MOZ_NULL_PRINCIPAL = "moz-nullprincipal:"
    
    1109 1125
             internal const val ABOUT_BLANK = "about:blank"
    
    1110 1126
             internal val BLOCKED_SCHEMES = listOf("content", "file", "resource") // See 1684761 and 1684947
    
    1127
    +        internal const val V2_DW_ADDRESS = "dwnewsvdyyiamwnp.onion"
    
    1128
    +        internal const val V3_DW_ADDRESS = "dwnewsgngmhlplxy6o2twtfgjnrnjxbegbwqx6wnotdhkzt562tszfid.onion"
    
    1111 1129
     
    
    1112 1130
             /**
    
    1113 1131
              * Provides an ErrorType corresponding to the error code provided.
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits