blob: ca86018aea818cedf04dab53e2c8f78d0521f271 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module network.mojom;
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/network/public/mojom/fetch_api.mojom";
import "services/network/public/mojom/http_raw_request_response_info.mojom";
import "services/network/public/mojom/ip_endpoint.mojom";
import "services/network/public/mojom/load_timing_info.mojom";
import "services/network/public/mojom/network_param.mojom";
import "services/network/public/mojom/network_types.mojom";
import "services/network/public/mojom/origin_policy_manager.mojom";
import "services/network/public/mojom/parsed_headers.mojom";
import "services/proxy_resolver/public/mojom/proxy_resolver.mojom";
import "url/mojom/url.mojom";
struct URLResponseHead {
// The time at which the request was made that resulted in this response.
// For cached responses, this time could be "far" in the past.
mojo_base.mojom.Time request_time;
// The time at which the response headers were received. For cached
// responses, this time could be "far" in the past.
mojo_base.mojom.Time response_time;
// The response headers or NULL if the URL type does not support headers.
HttpResponseHeaders headers;
// The mime type of the response. This may be a derived value.
string mime_type;
// The character encoding of the response or none if not applicable to the
// response's mime type. This may be a derived value.
string charset;
// The resource's compliance with the Certificate Transparency policy.
CTPolicyCompliance ct_policy_compliance;
// Content length if available. -1 if not available
int64 content_length = -1;
// Length of the encoded data transferred over the network. In case there is
// no data, contains -1.
int64 encoded_data_length = -1;
// Length of the response body data before decompression. -1 unless the body
// has been read to the end.
int64 encoded_body_length = -1;
// True if the request accessed the network in the process of retrieving data.
bool network_accessed = false;
// The appcache this response was loaded from, or
// kAppCacheNoCacheId (hard-coded as 0 because services/network
// can't take a dependency on Blink).
// TODO(rdsmith): Remove conceptual dependence on appcache.
int64 appcache_id = 0;
// The manifest url of the appcache this response was loaded from.
// Note: this value is only populated for main resource requests.
url.mojom.Url appcache_manifest_url;
// Detailed timing information used by the WebTiming, HAR and Developer
// Tools. Includes socket ID and socket reuse information.
LoadTimingInfo load_timing;
// Actual request and response headers, as obtained from the network stack.
// Only present if the renderer set report_raw_headers to true and had the
// CanReadRawCookies permission.
HttpRawRequestResponseInfo? raw_request_response_info;
// True if the response was delivered using SPDY.
bool was_fetched_via_spdy = false;
// True if the response was delivered after NPN is negotiated.
bool was_alpn_negotiated = false;
// True if response could use alternate protocol. However, browser will
// ignore the alternate protocol when spdy is not enabled on browser side.
bool was_alternate_protocol_available = false;
// Information about the type of connection used to fetch this response.
ConnectionInfo connection_info;
// ALPN protocol negotiated with the server.
string alpn_negotiated_protocol;
// Remote address of the socket which fetched this resource.
IPEndPoint remote_endpoint;
// True if the response came from cache.
bool was_fetched_via_cache = false;
// The proxy server used for this request, if any.
proxy_resolver.mojom.ProxyServer proxy_server;
// True if a service worker responded to the request. If the service worker
// received a fetch event and did not call respondWith(), or was bypassed due
// to absence of a fetch event handler, this function typically returns false
// but returns true if "fallback to renderer" was required (however in this
// case the response is not an actual resource and the request will be
// reissued by the renderer).
bool was_fetched_via_service_worker = false;
// Source of a serviceworker response - CacheStorage, HttpCache, Network or
// Unspecified (default).
// The value can be Unspecified in some cases including:
// 1. |was_fetched_via_service_worker| is false.
// 2. The service worker responded with an error (response status code is 0).
// 3. The service worker responded with a generated response, i.e.,
// `respondWith(new Response(...))`.
FetchResponseSource service_worker_response_source =
// True when a request whose mode is |CORS| or |CORS-with-forced-preflight|
// is sent to a ServiceWorker but FetchEvent.respondWith is not called. So the
// renderer has to resend the request with skip service worker flag
// considering the CORS preflight logic.
bool was_fallback_required_by_service_worker = false;
// The URL list of the Response object the service worker passed to
// respondWith() to create this response. For example, if the service worker
// calls respondWith(fetch('')) and
// redirects to which redirects to,
// the URL list is the vector <"", "",
// "">. This is empty if the response was programmatically
// generated as in respondWith(new Response()). It is also empty if a service
// worker did not respond to the request or did not call respondWith().
array<url.mojom.Url> url_list_via_service_worker;
FetchResponseType response_type = FetchResponseType.kDefault;
// The cache name of the CacheStorage from where the response is served via
// the ServiceWorker. Empty if the response isn't from the CacheStorage.
string cache_storage_cache_name;
// Bitmask of status info of the SSL certificate. See cert_status_flags.h for
// values.
uint32 cert_status = 0;
// Only provided if kURLLoadOptionSendSSLInfoWithResponse was specified to
// the URLLoaderFactory::CreateLoaderAndStart option or
// if ResourceRequest::report_raw_headers is set. When set via
// |report_raw_headers|, the SSLInfo is not guaranteed to be fully populated
// and may only contain certain fields of interest (namely, connection
// parameters and certificate information).
SSLInfo? ssl_info;
// In case this is a CORS response fetched by a ServiceWorker, this is the
// set of headers that should be exposed.
array<string> cors_exposed_header_names;
// True if service worker navigation preload was performed due to the request
// for this response.
bool did_service_worker_navigation_preload = false;
// Is used to report that a cross-origin response was blocked by Cross-Origin
// Read Blocking (CORB) from entering renderer. Corresponding message will be
// generated in devtools console if this flag is set to true.
bool should_report_corb_blocking = false;
// True if this resource is stale and needs async revalidation. Will only
// possibly be set if the load_flags indicated SUPPORT_ASYNC_REVALIDATION.
bool async_revalidation_requested = false;
// True if mime sniffing has been done. In that case, we don't need to do
// mime sniffing anymore.
bool did_mime_sniff = false;
// True if the response is an inner response of a signed exchange.
bool is_signed_exchange_inner_response = false;
// True if this resource is served from the prefetch cache.
bool was_in_prefetch_cache = false;
// True if the request included a cookie.
bool was_cookie_in_request = false;
// True if the response was intercepted by a plugin.
bool intercepted_by_plugin = false;
// True if the response was sent over TLS 1.0 or 1.1, which are deprecated and
// will be removed in the future.
bool is_legacy_tls_version = false;
bool has_range_requested = false;
bool timing_allow_passed = false;
// If the request received an authentication challenge, the challenge info is
// recorded here.
AuthChallengeInfo? auth_challenge_info;
// TimeTicks::Now() when the browser received the request from the renderer.
mojo_base.mojom.TimeTicks request_start;
// TimeTicks::Now() when the browser sent the response to the renderer.
mojo_base.mojom.TimeTicks response_start;
// A set of security related parsed headers. This is for clients that should
// not do the parsing themselves, because they aren't sandboxed (e.g. the
// browser process). This is the output of network::PopulateParsedHeaders().
// This can be null. It means the URLLoader didn't parsed the headers. Either
// it wasn't implemented or not allowed from its process.
ParsedHeaders? parsed_headers;
// Origin Policy associated with this response or nullptr if not applicable.
// Spec:
OriginPolicy? origin_policy;
// Set by the browser process on cross-origin prefetch responses. This token
// is propagated to the renderer and set on recursive prefetch requests
// (see corresponding documentation in url_loader.mojom).
mojo_base.mojom.UnguessableToken? recursive_prefetch_token;
// Aliases, if any, for the destination URL, as read from DNS CNAME records.
// The first entry of `dns_aliases`, if it exists, is the canonical name.
// The alias chain is preserved in reverse order, from canonical name (i.e.
// address record name) through to query name.
array<string> dns_aliases;
// The URL of WebBundle this response was loaded from. This value is only
// populated for resources loaded from a WebBundle.
url.mojom.Url web_bundle_url;