ObliviousHttpChannel.h (2346B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set sw=2 ts=8 et tw=80 : */ 3 4 /* This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 8 #ifndef mozilla_net_ObliviousHttpChannel_h 9 #define mozilla_net_ObliviousHttpChannel_h 10 11 #include "nsIBinaryHttp.h" 12 #include "nsIHttpChannel.h" 13 #include "nsIHttpChannelInternal.h" 14 #include "nsIObliviousHttp.h" 15 #include "nsIObliviousHttpChannel.h" 16 #include "nsIStreamListener.h" 17 #include "nsITimedChannel.h" 18 #include "nsIUploadChannel2.h" 19 #include "nsTHashMap.h" 20 21 namespace mozilla::net { 22 23 class ObliviousHttpChannel final : public nsIObliviousHttpChannel, 24 public nsIHttpChannelInternal, 25 public nsIStreamListener, 26 public nsIUploadChannel2, 27 public nsITimedChannel { 28 public: 29 NS_DECL_THREADSAFE_ISUPPORTS 30 NS_DECL_NSICHANNEL 31 NS_DECL_NSIHTTPCHANNEL 32 NS_DECL_NSIOBLIVIOUSHTTPCHANNEL 33 NS_DECL_NSIREQUESTOBSERVER 34 NS_DECL_NSISTREAMLISTENER 35 NS_DECL_NSIUPLOADCHANNEL2 36 37 ObliviousHttpChannel(nsIURI* targetURI, 38 const nsTArray<uint8_t>& encodedConfig, 39 nsIHttpChannel* innerChannel); 40 41 NS_FORWARD_SAFE_NSIREQUEST(mInnerChannel) 42 NS_FORWARD_SAFE_NSIIDENTCHANNEL(mInnerChannel) 43 NS_FORWARD_SAFE_NSIHTTPCHANNELINTERNAL(mInnerChannelInternal) 44 NS_FORWARD_SAFE_NSITIMEDCHANNEL(mInnerChannelTimed) 45 46 protected: 47 ~ObliviousHttpChannel(); 48 49 nsresult ProcessOnStopRequest(); 50 void EmitOnDataAvailable(); 51 52 nsCOMPtr<nsIURI> mTargetURI; 53 nsTArray<uint8_t> mEncodedConfig; 54 55 nsCString mMethod{"GET"_ns}; 56 nsCString mContentType; 57 nsTHashMap<nsCStringHashKey, nsCString> mHeaders; 58 nsTArray<uint8_t> mContent; 59 60 nsCOMPtr<nsIHttpChannel> mInnerChannel; 61 nsCOMPtr<nsIHttpChannelInternal> mInnerChannelInternal; 62 nsCOMPtr<nsITimedChannel> mInnerChannelTimed; 63 nsCOMPtr<nsIObliviousHttpClientRequest> mEncapsulatedRequest; 64 nsTArray<uint8_t> mRawResponse; 65 nsCOMPtr<nsIBinaryHttpResponse> mBinaryHttpResponse; 66 67 nsCOMPtr<nsIStreamListener> mStreamListener; 68 }; 69 70 } // namespace mozilla::net 71 72 #endif // mozilla_net_ObliviousHttpChannel_h