[tbb-commits] [tor-browser] 03/03: fixup! Bug 40458: Implement .tor.onion aliases

gitolite role git at cupani.torproject.org
Tue Oct 25 17:23:34 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-102.4.0esr-12.0-1
in repository tor-browser.

commit dae0e8fa0796265e0e321aca60843e46027fd6d4
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Tue Oct 25 18:58:33 2022 +0200

    fixup! Bug 40458: Implement .tor.onion aliases
---
 netwerk/dns/OnionAliasService.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/netwerk/dns/OnionAliasService.cpp b/netwerk/dns/OnionAliasService.cpp
index 3d8a7643b045..50d9841e87b6 100644
--- a/netwerk/dns/OnionAliasService.cpp
+++ b/netwerk/dns/OnionAliasService.cpp
@@ -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;
@@ -24,7 +23,7 @@ static bool ValidateOnionV3(nsACString &aHostname)
     return false;
   }
 
-  char* cur = aHostname.BeginWriting();
+  const char* cur = aHostname.BeginWriting();
   // We have already checked that it ends by ".onion"
   const char* end = aHostname.EndWriting() - 6;
   for (; cur < end; ++cur) {
@@ -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)) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list