Commit 26c9c3aa authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Update URLRequestJob, cache, and scheme sections of Life of a URLRequest

In particular, mention SameSite cookies, assembling the cache key
(using the NIK), provide a bit more detail on other schemes,
particularly websockets and data URLs, and remove information about
FTP.

Bug: None
Change-Id: I3fe69c2f7ea7b4d1e299d9c68973142b87dafcdc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144685
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758266}
parent 6edfeadd
...@@ -197,23 +197,27 @@ request. ...@@ -197,23 +197,27 @@ request.
Summary: Summary:
* The URLRequest asks the URLRequestJobFactory to create a URLRequestJob, in * The URLRequest asks the URLRequestJobFactory to create a URLRequestJob,
this case, a URLRequestHttpJob. and gets a URLRequestHttpJob.
* The URLRequestHttpJob asks the HttpCache to create an HttpTransaction * The URLRequestHttpJob asks the HttpCache to create an HttpTransaction, and
(always an HttpCache::Transaction). gets an HttpCache::Transaction, assuming caching is enabled.
* The HttpCache::Transaction sees there's no cache entry for the request, * The HttpCache::Transaction sees there's no cache entry for the request,
and creates an HttpNetworkTransaction. and creates an HttpNetworkTransaction.
* The HttpNetworkTransaction calls into the HttpStreamFactory to request an * The HttpNetworkTransaction calls into the HttpStreamFactory to request an
HttpStream. HttpStream.
The URLRequest then calls into the URLRequestJobFactory to create a The URLRequest then calls into the URLRequestJobFactory to create a
URLRequestJob and then starts it. In the case of an HTTP or HTTPS request, this URLRequestHttpJob, a subclass of URLRequestJob, and then starts it
will be a URLRequestHttpJob. The URLRequestHttpJob attaches cookies to the (historically, non-network URL schemes were also disptched through the
request, if needed. network stack, so there were a variety of job types.) The
URLRequestHttpJob attaches cookies to the request, if needed. Whether or
not SameSite cookies are attached depends on the IsolationInfo's
SiteForCookies, the URL, and the URLRequest's request_initiator field.
The URLRequestHttpJob calls into the HttpCache to create an The URLRequestHttpJob calls into the HttpCache to create an
HttpCache::Transaction. If there's no matching entry in the cache, the HttpCache::Transaction. The cache checks for an entry with the same URL
HttpCache::Transaction will just call into the HttpNetworkLayer to create an and NetworkIsolationKey. If there's no matching entry, the
HttpCache::Transaction will call into the HttpNetworkLayer to create an
HttpNetworkTransaction, and transparently wrap it. The HttpNetworkTransaction HttpNetworkTransaction, and transparently wrap it. The HttpNetworkTransaction
then calls into the HttpStreamFactory to request an HttpStream to the server. then calls into the HttpStreamFactory to request an HttpStream to the server.
...@@ -580,13 +584,33 @@ priority socket request. ...@@ -580,13 +584,33 @@ priority socket request.
## Non-HTTP Schemes ## Non-HTTP Schemes
The URLRequestJobFactory has a ProtocolHander for ftp, http, https, and data WebSockets requests (wss:// and ws://) start as HTTP requests with an HTTP
URLs, though most data URLs are handled directly in the renderer. For other upgrade header. Once the handshake completes successfully, the connection
schemes, and non-network code that can intercept HTTP/HTTPS requests (like is used as a full-duplex communication channel to the server for WebSocket
ServiceWorker, or extensions), there's typically another frames, rather than to receive an HTTP response body. WebSockets have their
network::mojom::URLLoaderFactory class that is used instead of own Mojo interfaces and //net classes, but internally they reuse the full
network::URLLoaderFactory. These URLLoaderFactories are not part of the URLRequest machinery up to the point headers are received from the server.
network service. Some of these are web standards and handled in content/ Then the connection is handed off to the WebSocket code to manage.
code (like blob:// and file:// URLs), while other of these are
Chrome-specific, and implemented in chrome/ (like chrome:// and Other schemes typically have their own network::mojom::URLLoaderFactory that
chrome-extension:// URLs). is not part of the network service. Standard schemes like file:// and blob://
are handled by the content layer and its dependencies
(content::FileURLLoaderFactory and storage::BlobURLLoaderFactory, respectively,
for those two schemes). Chrome-specific schemes, like externalfile:// and
chrome-extension:// are often handled by a URLLoaderFactory in the chrome layer,
though chrome:// itself is actually handled in //content.
data:// URLs are handled a bit differently from other schemes. If a renderer
process requests a data:// subresource, the renderer typically decodes it
internally, as sending it to an out-of-process URLLoader would be inefficient.
Navigations are a bit different. To navigate to a URL, the browser process
creates a URLLoader and passes it over to a renderer process. So in the
case of a navigation to a data:// URL, a URLLoader is created using a
content::DataURLLoaderFactory that lives in the browser process, and then a
mojo::Remote for the browser-hosted URLLoader is passed to a renderer
proceess.
about:blank is similarly often handled in the renderer, though there is a
factory for that used in the case of navigations as well. Other about: URLs
are mapped to the corresponding Chrome URLs by the navigation code, rather
than having that logic live in a URLLoaderFactory.
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment