1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "network/public/interfaces/http_message.mojom";
8 import "network/public/interfaces/network_error.mojom";
14 // The HTTP method if applicable.
15 string method = "GET";
17 // Additional HTTP request headers.
18 array<HttpHeader>? headers;
20 // The payload for the request body, represented as a concatenation of data
21 // streams. For HTTP requests, the method must be set to "POST" or "PUT".
22 array<handle<data_pipe_consumer>>? body;
24 // The buffer size of the data pipe returned in URLResponse's |body| member.
25 // A value of 0 indicates that the default buffer size should be used. This
26 // value is just a suggestion. The URLLoader may choose to ignore this value.
27 uint32 response_body_buffer_size = 0;
29 // If set to true, then redirects will be automatically followed. Otherwise,
30 // when a redirect is encounterd, FollowRedirect must be called to proceed.
31 bool auto_follow_redirects = false;
33 // If set to true, then the HTTP request will bypass the local cache and will
34 // have a 'Cache-Control: nocache' header added in that causes any proxy
35 // servers to also not satisfy the request from their cache. This has the
36 // effect of forcing a full end-to-end fetch.
37 bool bypass_cache = false;
41 // If the response resulted in a network level error, this field will be set.
44 // The response body stream. Read from this data pipe to receive the bytes of
46 handle<data_pipe_consumer>? body;
48 // The final URL of the response, after redirects have been followed.
51 // The site of the URL.
54 // The HTTP status code. 0 if not applicable.
57 // The HTTP status line.
60 // The HTTP response headers.
61 array<HttpHeader>? headers;
63 // The MIME type of the response body.
66 // The character set of the response body.
69 // These fields are set to non-NULL if this response corresponds to a
70 // redirect. Call the |FollowRedirect| method on the URLLoader instance to
71 // follow this redirect.
72 string? redirect_method;
74 string? redirect_referrer;
77 struct URLLoaderStatus {
78 // If the loader has failed due to a network level error, this field will be
82 // Set to true if the URLLoader is still working. Set to false once an error
83 // is encountered or the response body is completely copied to the response
87 // TODO(darin): Add further details about the stages of loading (e.g.,
88 // "resolving host") that happen prior to receiving bytes.
92 // Loads the given |request|, asynchronously producing |response|. Consult
93 // |response| to determine if the request resulted in an error, was
94 // redirected, or has a response body to be consumed.
95 Start(URLRequest request) => (URLResponse response);
97 // If the request passed to |Start| had |auto_follow_redirects| set to false,
98 // then upon receiving an URLResponse with a non-NULL |redirect_url| field,
99 // |FollowRedirect| may be called to load the URL indicated by the redirect.
100 FollowRedirect() => (URLResponse response);
102 // Query status about the URLLoader.
103 QueryStatus() => (URLLoaderStatus status);