summaryrefslogtreecommitdiffstats
path: root/chromium/services/network/public/mojom/url_response_head.mojom
blob: d24f063b8eb1de1f7b87c222f177522039d7b59b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
// 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 =
      FetchResponseSource.kUnspecified;

  // 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('http://example.com/a')) and http://example.com/a
  // redirects to http://example.net/b which redirects to http://example.org/c,
  // the URL list is the vector <"http://example.com/a", "http://example.net/b",
  // "http://example.org/c">. 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;

  // https://fetch.spec.whatwg.org/#concept-response-type
  FetchResponseType response_type = FetchResponseType.kDefault;

  // Pre-computed padding.  This should only be non-zero when |response_type|
  // is set to kOpaque.  Note, this is not set by network service, but will be
  // populated if the response was provided by a service worker FetchEvent
  // handler.
  int64 padding = 0;

  // 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;

  // https://fetch.spec.whatwg.org/#concept-response-range-requested-flag
  bool has_range_requested = false;

  // https://fetch.spec.whatwg.org/#concept-response-timing-allow-passed
  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: https://wicg.github.io/origin-policy/
  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;
};