/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
class nsIEventTraget; class nsIInputStream; class nsIInterfaceRequestor; class nsIRequest; class nsIRequestContext; class nsITransportEventSink;
namespace mozilla::net {
enum HttpTrafficCategory : uint8_t; class Http2PushedStreamWrapper; class HttpTransactionParent; class nsHttpConnectionInfo; class nsHttpHeaderArray; class nsHttpRequestHead; class nsHttpTransaction; class TransactionObserverResult; union NetAddr;
//---------------------------------------------------------------------------- // Abstract base class for a HTTP transaction in the chrome process //----------------------------------------------------------------------------
class HttpTransactionShell : public nsISupports { public:
NS_DECLARE_STATIC_IID_ACCESSOR(HTTPTRANSACTIONSHELL_IID)
using TransactionObserverFunc =
std::function<void(TransactionObserverResult&&)>; using OnPushCallback = std::function<nsresult(
uint32_t, const nsACString&, const nsACString&, HttpTransactionShell*)>;
// // called to initialize the transaction // // @param caps // the transaction capabilities (see nsHttp.h) // @param connInfo // the connection type for this transaction. // @param reqHeaders // the request header struct // @param reqBody // the request body (POST or PUT data stream) // @param reqBodyIncludesHeaders // fun stuff to support NPAPI plugins. // @param target // the dispatch target were notifications should be sent. // @param callbacks // the notification callbacks to be given to PSM. // @param browserId // indicate the id of the browser in which this transaction is being // loaded.
[[nodiscard]] nsresult virtual Init(
uint32_t caps, nsHttpConnectionInfo* connInfo,
nsHttpRequestHead* reqHeaders, nsIInputStream* reqBody,
uint64_t reqContentLength, bool reqBodyIncludesHeaders,
nsIEventTarget* consumerTarget, nsIInterfaceRequestor* callbacks,
nsITransportEventSink* eventsink, uint64_t browserId,
HttpTrafficCategory trafficCategory, nsIRequestContext* requestContext,
ClassOfService classOfService, uint32_t initialRwin, bool responseTimeoutEnabled, uint64_t channelId,
TransactionObserverFunc&& transactionObserver,
OnPushCallback&& aOnPushCallback,
HttpTransactionShell* aTransWithPushedStream,
uint32_t aPushedStreamId) = 0;
// @param aListener // receives notifications. // @param pump // the pump that will contain the response data. async wait on this // input stream for data. On first notification, headers should be // available (check transaction status). virtual nsresult AsyncRead(nsIStreamListener* listener,
nsIRequest** pump) = 0;
// Called to take ownership of the response headers; the transaction // will drop any reference to the response headers after this call. virtual UniquePtr<nsHttpResponseHead> TakeResponseHead() = 0;
// Called to take ownership of the trailer headers. // Returning null if there is no trailer. virtual UniquePtr<nsHttpHeaderArray> TakeResponseTrailers() = 0;
// Called to set/find out if the transaction generated a complete response. virtualbool ResponseIsComplete() = 0; virtual int64_t GetTransferSize() = 0; virtual int64_t GetRequestSize() = 0; virtualbool IsHttp3Used() = 0;
// Called to notify that a requested DNS cache entry was refreshed. virtualvoid SetDNSWasRefreshed() = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.