/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:set ts=4 sw=2 sts=2 et cin: */ /* 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/. */
// a transaction with this caps flag will continue to own the connection, // preventing it from being reclaimed, even after the transaction completes. #define NS_HTTP_STICKY_CONNECTION (1 << 2)
// a transaction with this caps flag will, upon opening a new connection, // bypass the local DNS cache #define NS_HTTP_REFRESH_DNS (1 << 3)
// a transaction with this caps flag will not pass SSL client-certificates // to the server (see bug #466080), but is may also be used for other things #define NS_HTTP_LOAD_ANONYMOUS (1 << 4)
// a transaction with this flag blocks the initiation of other transactons // in the same load group until it is complete #define NS_HTTP_LOAD_AS_BLOCKING (1 << 6)
// Disallow the use of the SPDY protocol. This is meant for the contexts // such as HTTP upgrade which are nonsensical for SPDY, it is not the // SPDY configuration variable. #define NS_HTTP_DISALLOW_SPDY (1 << 7)
// a transaction with this flag loads without respect to whether the load // group is currently blocking on some resources #define NS_HTTP_LOAD_UNBLOCKED (1 << 8)
// This flag indicates the transaction should accept associated pushes #define NS_HTTP_ONPUSH_LISTENER (1 << 9)
// Transactions with this flag should react to errors without side effects // First user is to prevent clearing of alt-svc cache on failed probe #define NS_HTTP_ERROR_SOFTLY (1 << 10)
// This corresponds to nsIHttpChannelInternal.beConservative // it disables any cutting edge features that we are worried might result in // interop problems with critical infrastructure #define NS_HTTP_BE_CONSERVATIVE (1 << 11)
// Transactions with this flag should be processed first. #define NS_HTTP_URGENT_START (1 << 12)
// A sticky connection of the transaction is explicitly allowed to be restarted // on ERROR_NET_RESET. #define NS_HTTP_CONNECTION_RESTARTABLE (1 << 13)
// Allow re-using a spdy/http2 connection with NS_HTTP_ALLOW_KEEPALIVE not set. // This is primarily used to allow connection sharing for websockets over http/2 // without accidentally allowing it for websockets not over http/2 #define NS_HTTP_ALLOW_SPDY_WITHOUT_KEEPALIVE (1 << 15)
// Only permit CONNECTing to a proxy. A channel with this flag will not send an // http request after CONNECT or setup tls. An http upgrade handler MUST be // set. An ALPN header is set using the upgrade protocol. #define NS_HTTP_CONNECT_ONLY (1 << 16)
// The connection should not use IPv4. #define NS_HTTP_DISABLE_IPV4 (1 << 17)
// The connection should not use IPv6 #define NS_HTTP_DISABLE_IPV6 (1 << 18)
// Disallow the use of the HTTP3 protocol. This is meant for the contexts // such as HTTP upgrade which are not supported by HTTP3. #define NS_HTTP_DISALLOW_HTTP3 (1 << 21)
// Force a transaction to stay in pending queue until the HTTPS RR is // available. #define NS_HTTP_FORCE_WAIT_HTTP_RR (1 << 22)
// This is used for a temporary workaround for a web-compat issue. The flag is // only set on CORS preflight request to allowed sending client certificates // on a connection for an anonymous request. #define NS_HTTP_LOAD_ANONYMOUS_CONNECT_ALLOW_CLIENT_CERT (1 << 23)
#define NS_HTTP_DISALLOW_HTTPS_RR (1 << 24)
#define NS_HTTP_DISALLOW_ECH (1 << 25)
// Used to indicate that an HTTP Connection should obey Resist Fingerprinting // and set the User-Agent accordingly. #define NS_HTTP_USE_RFP (1 << 26)
// If set, then the initial TLS handshake failed. #define NS_HTTP_IS_RETRY (1 << 27)
// When set, disallow to connect to a HTTP/2 proxy. #define NS_HTTP_DISALLOW_HTTP2_PROXY (1 << 28)
// When set, setup TLS tunnel even when HTTP proxy is used. // Need to be used together with NS_HTTP_CONNECT_ONLY #define NS_HTTP_TLS_TUNNEL (1 << 29)
// Strip the leading or trailing HTTP whitespace per fetch spec section 2.2. void TrimHTTPWhitespace(const nsACString& aSource, nsACString& aDest);
// Returns true if the specified value is reasonable given the defintion // in RFC 2616 section 4.2. Full strict validation is not performed // currently as it would require full parsing of the value. bool IsReasonableHeaderValue(const nsACString& s);
// find the first instance (case-insensitive comparison) of the given // |token| in the |input| string. the |token| is bounded by elements of // |separators| and may appear at the beginning or end of the |input| // string. null is returned if the |token| is not found. |input| may be // null, in which case null is returned. constchar* FindToken(constchar* input, constchar* token, constchar* seps);
// This function parses a string containing a decimal-valued, non-negative // 64-bit integer. If the value would exceed INT64_MAX, then false is // returned. Otherwise, this function returns true and stores the // parsed value in |result|. The next unparsed character in |input| is // optionally returned via |next| if |next| is non-null. // // TODO(darin): Replace this with something generic. //
[[nodiscard]] bool ParseInt64(constchar* input, constchar** next,
int64_t* result);
// Variant on ParseInt64 that expects the input string to contain nothing // more than the value being parsed.
[[nodiscard]] inlinebool ParseInt64(constchar* input, int64_t* result) { constchar* next; return ParseInt64(input, &next, result) && *next == '\0';
}
// Return whether the HTTP status code represents a permanent redirect bool IsPermanentRedirect(uint32_t httpStatus);
// Returns the APLN token which represents the used protocol version. constchar* GetProtocolVersion(HttpVersion pv);
// Called when an optimization feature affecting active vs background tab load // took place. Called only on the parent process and only updates // mLastActiveTabLoadOptimizationHit timestamp to now. void NotifyActiveTabLoadOptimization();
TimeStamp GetLastActiveTabLoadOptimizationHit(); void SetLastActiveTabLoadOptimizationHit(TimeStamp const& when); bool IsBeforeLastActiveTabLoadOptimization(TimeStamp const& when);
voidoperator=(const nsHttpAtom& a) { _val = a._val; }
// This constructor is mainly used to build the static atom list // Avoid using it for anything else. explicit nsHttpAtom(const nsACString& val) : _val(val) {}
// Declare all atoms // // The atom names and values are stored in nsHttpAtomList.h and are brought // to you by the magic of C preprocessing. Add new atoms to nsHttpAtomList // and all support logic will be auto-generated. // #define HTTP_ATOM(_name, _value) \ inline constexpr nsHttpAtomLiteral _name(_value); #include"nsHttpAtomList.h" #undef HTTP_ATOM
} // namespace nsHttp
class ParsedHeaderValueListList { public: // RFC 7231 section 3.2.6 defines the syntax of the header field values. // |allowInvalidValue| indicates whether the rule will be used to check // the input text. // Note that ParsedHeaderValueListList is currently used to parse // Alt-Svc and Server-Timing header. |allowInvalidValue| is set to true // when parsing Alt-Svc for historical reasons. explicit ParsedHeaderValueListList(const nsCString& fullHeader, bool allowInvalidValue = true);
nsTArray<ParsedHeaderValueList> mValues;
private:
nsCString mFull;
};
void LogHeaders(constchar* lineStart);
// Convert HTTP response codes returned by a proxy to nsresult. // This function should be only used when we get a failed response to the // CONNECT method.
nsresult HttpProxyResponseToErrorCode(uint32_t aStatusCode);
// Convert an alpn string to SupportedAlpnType.
SupportedAlpnRank IsAlpnSupported(const nsACString& aAlpn);
enumclass ProxyDNSStrategy : uint8_t { // To resolve the origin of the end server we are connecting // to.
ORIGIN = 1 << 0, // To resolve the host name of the proxy.
PROXY = 1 << 1
};
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.