OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module mojo; | 5 module mojo; |
6 | 6 |
| 7 import "network/public/interfaces/http_message.mojom"; |
7 import "network/public/interfaces/network_error.mojom"; | 8 import "network/public/interfaces/network_error.mojom"; |
8 | 9 |
9 struct URLRequest { | 10 struct URLRequest { |
10 // The URL to load. | 11 // The URL to load. |
11 string url; | 12 string url; |
12 | 13 |
13 // The HTTP method if applicable. | 14 // The HTTP method if applicable. |
14 string method = "GET"; | 15 string method = "GET"; |
15 | 16 |
16 // Additional HTTP request headers. | 17 // Additional HTTP request headers. |
17 array<string>? headers; | 18 array<HttpHeader>? headers; |
18 | 19 |
19 // The payload for the request body, represented as a concatenation of data | 20 // The payload for the request body, represented as a concatenation of data |
20 // streams. For HTTP requests, the method must be set to "POST" or "PUT". | 21 // streams. For HTTP requests, the method must be set to "POST" or "PUT". |
21 array<handle<data_pipe_consumer>>? body; | 22 array<handle<data_pipe_consumer>>? body; |
22 | 23 |
23 // The buffer size of the data pipe returned in URLResponse's |body| member. | 24 // The buffer size of the data pipe returned in URLResponse's |body| member. |
24 // A value of 0 indicates that the default buffer size should be used. This | 25 // A value of 0 indicates that the default buffer size should be used. This |
25 // value is just a suggestion. The URLLoader may choose to ignore this value. | 26 // value is just a suggestion. The URLLoader may choose to ignore this value. |
26 uint32 response_body_buffer_size = 0; | 27 uint32 response_body_buffer_size = 0; |
27 | 28 |
28 // If set to true, then redirects will be automatically followed. Otherwise, | 29 // If set to true, then redirects will be automatically followed. Otherwise, |
29 // when a redirect is encounterd, FollowRedirect must be called to proceed. | 30 // when a redirect is encounterd, FollowRedirect must be called to proceed. |
30 bool auto_follow_redirects = false; | 31 bool auto_follow_redirects = false; |
31 | 32 |
32 // If set to true, then the HTTP request will bypass the local cache and will | 33 // If set to true, then the HTTP request will bypass the local cache and will |
33 // have a 'Cache-Control: nocache' header added in that causes any proxy | 34 // have a 'Cache-Control: nocache' header added in that causes any proxy |
34 // servers to also not satisfy the request from their cache. This has the | 35 // servers to also not satisfy the request from their cache. This has the |
35 // effect of forcing a full end-to-end fetch. | 36 // effect of forcing a full end-to-end fetch. |
36 bool bypass_cache = false; | 37 bool bypass_cache = false; |
37 | |
38 // The referrer request header. | |
39 string? referrer; | |
40 }; | 38 }; |
41 | 39 |
42 struct URLResponse { | 40 struct URLResponse { |
43 // If the response resulted in a network level error, this field will be set. | 41 // If the response resulted in a network level error, this field will be set. |
44 NetworkError? error; | 42 NetworkError? error; |
45 | 43 |
46 // The response body stream. Read from this data pipe to receive the bytes of | 44 // The response body stream. Read from this data pipe to receive the bytes of |
47 // response body. | 45 // response body. |
48 handle<data_pipe_consumer>? body; | 46 handle<data_pipe_consumer>? body; |
49 | 47 |
50 // The final URL of the response, after redirects have been followed. | 48 // The final URL of the response, after redirects have been followed. |
51 string? url; | 49 string? url; |
52 | 50 |
53 // The HTTP status code. 0 if not applicable. | 51 // The HTTP status code. 0 if not applicable. |
54 uint32 status_code; | 52 uint32 status_code; |
55 | 53 |
56 // The HTTP status line. | 54 // The HTTP status line. |
57 string? status_line; | 55 string? status_line; |
58 | 56 |
59 // The HTTP response headers. | 57 // The HTTP response headers. |
60 array<string>? headers; | 58 array<HttpHeader>? headers; |
61 | 59 |
62 // The MIME type of the response body. | 60 // The MIME type of the response body. |
63 string? mime_type; | 61 string? mime_type; |
64 | 62 |
65 // The character set of the response body. | 63 // The character set of the response body. |
66 string? charset; | 64 string? charset; |
67 | 65 |
68 // These fields are set to non-NULL if this response corresponds to a | 66 // These fields are set to non-NULL if this response corresponds to a |
69 // redirect. Call the |FollowRedirect| method on the URLLoader instance to | 67 // redirect. Call the |FollowRedirect| method on the URLLoader instance to |
70 // follow this redirect. | 68 // follow this redirect. |
(...skipping 23 matching lines...) Expand all Loading... |
94 Start(URLRequest request) => (URLResponse response); | 92 Start(URLRequest request) => (URLResponse response); |
95 | 93 |
96 // If the request passed to |Start| had |auto_follow_redirects| set to false, | 94 // If the request passed to |Start| had |auto_follow_redirects| set to false, |
97 // then upon receiving an URLResponse with a non-NULL |redirect_url| field, | 95 // then upon receiving an URLResponse with a non-NULL |redirect_url| field, |
98 // |FollowRedirect| may be called to load the URL indicated by the redirect. | 96 // |FollowRedirect| may be called to load the URL indicated by the redirect. |
99 FollowRedirect() => (URLResponse response); | 97 FollowRedirect() => (URLResponse response); |
100 | 98 |
101 // Query status about the URLLoader. | 99 // Query status about the URLLoader. |
102 QueryStatus() => (URLLoaderStatus status); | 100 QueryStatus() => (URLLoaderStatus status); |
103 }; | 101 }; |
OLD | NEW |