Skip to content
Snippets Groups Projects

Bug 40491: Don't auto-pick a v2 address when it's in Onion-Location header

All threads resolved!
@@ -13,8 +13,7 @@
* verification.
* @return Tells whether the input string is an Onion v3 address
*/
static bool ValidateOnionV3(nsACString &aHostname)
{
static bool ValidateOnionV3(nsACString& aHostname) {
constexpr nsACString::size_type v3Length = 56 + 6;
if (aHostname.Length() != v3Length) {
return false;
@@ -55,11 +54,11 @@ already_AddRefed<IOnionAliasService> OnionAliasService::GetSingleton() {
NS_IMETHODIMP
OnionAliasService::AddOnionAlias(const nsACString& aShortHostname,
const nsACString& aLongHostname) {
const nsACString& aLongHostname) {
nsAutoCString shortHostname;
ToLowerCase(aShortHostname, shortHostname);
mozilla::UniquePtr<nsAutoCString> longHostname =
mozilla::MakeUnique<nsAutoCString>(aLongHostname);
mozilla::MakeUnique<nsAutoCString>(aLongHostname);
if (!longHostname) {
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -73,8 +72,8 @@ OnionAliasService::AddOnionAlias(const nsACString& aShortHostname,
}
NS_IMETHODIMP
OnionAliasService::GetOnionAlias(const nsACString& aShortHostname, nsACString& aLongHostname)
{
OnionAliasService::GetOnionAlias(const nsACString& aShortHostname,
nsACString& aLongHostname) {
aLongHostname = aShortHostname;
if (mozilla::StaticPrefs::browser_urlbar_onionRewrites_enabled() &&
StringEndsWith(aShortHostname, ".tor.onion"_ns)) {
Loading