tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HTTPSRecordResolver.h (1653B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
      2 /* vim:set ts=4 sw=4 sts=4 et cin: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef HTTPSRecordResolver_h__
      8 #define HTTPSRecordResolver_h__
      9 
     10 #include "mozilla/Mutex.h"
     11 #include "nsICancelable.h"
     12 #include "nsIDNSListener.h"
     13 #include "nsHttpConnectionInfo.h"
     14 
     15 class nsIDNSAddrRecord;
     16 class nsIDNSHTTPSSVCRecord;
     17 
     18 namespace mozilla {
     19 namespace net {
     20 
     21 class nsAHttpTransaction;
     22 
     23 // This class is the place to put some common code about fetching HTTPS RR.
     24 class HTTPSRecordResolver : public nsIDNSListener {
     25 public:
     26  NS_DECL_THREADSAFE_ISUPPORTS
     27  NS_DECL_NSIDNSLISTENER
     28 
     29  explicit HTTPSRecordResolver(nsAHttpTransaction* aTransaction);
     30  nsresult FetchHTTPSRRInternal(nsIEventTarget* aTarget,
     31                                nsICancelable** aDNSRequest);
     32  void PrefetchAddrRecord(const nsACString& aTargetName, bool aRefreshDNS);
     33 
     34  void Close();
     35 
     36 protected:
     37  virtual ~HTTPSRecordResolver();
     38 
     39 private:
     40  nsresult InvokeCallback();
     41 
     42  mozilla::Mutex mMutex{"HTTPSRecordResolver::mMutex"};
     43  RefPtr<nsAHttpTransaction> mTransaction;
     44  RefPtr<nsHttpConnectionInfo> mConnInfo;
     45  nsCOMPtr<nsICancelable> mCnameRequest MOZ_GUARDED_BY(mMutex);
     46  nsCOMPtr<nsICancelable> mHTTPSRecordRequest MOZ_GUARDED_BY(mMutex);
     47  nsCOMPtr<nsIDNSAddrRecord> mAddrRecord;
     48  nsCOMPtr<nsIDNSHTTPSSVCRecord> mHTTPSRecord;
     49  bool mDone = false;
     50 };
     51 
     52 }  // namespace net
     53 }  // namespace mozilla
     54 
     55 #endif  // HTTPSRecordResolver_h__