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

[tor-commits] [tor-browser/tor-browser-68.11.0esr-9.5-1] fixup! Bug 21952: Implement Onion-Location



commit 2af44e4e4eab2c3d80625d5e4ddb69eaa4dd0432
Author: Alex Catarineu <acat@xxxxxxxxxxxxxx>
Date:   Thu Jul 2 21:38:54 2020 +0200

    fixup! Bug 21952: Implement Onion-Location
---
 dom/base/Document.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
index 994f52659265..1a565a48f6dd 100644
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -3735,16 +3735,17 @@ void Document::GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const {
 static bool IsValidOnionLocation(nsIURI* aDocumentURI,
                                  nsIURI* aOnionLocationURI) {
   bool isHttpish;
-  nsAutoCString onionHost;
+  nsAutoCString host;
   return aDocumentURI && aOnionLocationURI &&
          NS_SUCCEEDED(aDocumentURI->SchemeIs("https", &isHttpish)) &&
-         isHttpish &&
+         isHttpish && NS_SUCCEEDED(aDocumentURI->GetAsciiHost(host)) &&
+         !StringEndsWith(host, NS_LITERAL_CSTRING(".onion")) &&
          ((NS_SUCCEEDED(aOnionLocationURI->SchemeIs("http", &isHttpish)) &&
            isHttpish) ||
           (NS_SUCCEEDED(aOnionLocationURI->SchemeIs("https", &isHttpish)) &&
            isHttpish)) &&
-         NS_SUCCEEDED(aOnionLocationURI->GetAsciiHost(onionHost)) &&
-         StringEndsWith(onionHost, NS_LITERAL_CSTRING(".onion"));
+         NS_SUCCEEDED(aOnionLocationURI->GetAsciiHost(host)) &&
+         StringEndsWith(host, NS_LITERAL_CSTRING(".onion"));
 }
 
 void Document::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData) {

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