OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains URLFetcher, a wrapper around net::URLRequest that handles | 5 // This file contains URLFetcher, a wrapper around net::URLRequest that handles |
6 // low-level details like thread safety, ref counting, and incremental buffer | 6 // low-level details like thread safety, ref counting, and incremental buffer |
7 // reading. This is useful for callers who simply want to get the data from a | 7 // reading. This is useful for callers who simply want to get the data from a |
8 // URL and don't care about all the nitty-gritty details. | 8 // URL and don't care about all the nitty-gritty details. |
9 // | 9 // |
10 // NOTE(willchan): Only one "IO" thread is supported for URLFetcher. This is a | 10 // NOTE(willchan): Only one "IO" thread is supported for URLFetcher. This is a |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 static URLFetcher* Create(int id, const GURL& url, RequestType request_type, | 125 static URLFetcher* Create(int id, const GURL& url, RequestType request_type, |
126 Delegate* d); | 126 Delegate* d); |
127 | 127 |
128 // Sets data only needed by POSTs. All callers making POST requests should | 128 // Sets data only needed by POSTs. All callers making POST requests should |
129 // call this before the request is started. |upload_content_type| is the MIME | 129 // call this before the request is started. |upload_content_type| is the MIME |
130 // type of the content, while |upload_content| is the data to be sent (the | 130 // type of the content, while |upload_content| is the data to be sent (the |
131 // Content-Length header value will be set to the length of this data). | 131 // Content-Length header value will be set to the length of this data). |
132 void set_upload_data(const std::string& upload_content_type, | 132 void set_upload_data(const std::string& upload_content_type, |
133 const std::string& upload_content); | 133 const std::string& upload_content); |
134 | 134 |
135 // Indicates that the POST data is sent via chunked transfer encoding. | |
136 // This may only be called before calling Start(). | |
137 // Use AppendChunkToUpload() to give the data chunks after calling Start(). | |
138 void set_chunked_upload(const std::string& upload_content_type); | |
139 | |
140 // Adds the given bytes to a requests's POST data transmitted using chunked | |
wtc
2011/01/20 00:29:47
Nit: requests's => request's
| |
141 // transfer encoding. | |
142 // This method should be called ONLY after calling Start(). | |
143 void AppendChunkToUpload(const std::string& data); | |
144 void MarkEndOfChunks(); | |
wtc
2011/01/20 00:29:47
Document the MarkEndOfChunks method.
| |
145 | |
135 // Set one or more load flags as defined in net/base/load_flags.h. Must be | 146 // Set one or more load flags as defined in net/base/load_flags.h. Must be |
136 // called before the request is started. | 147 // called before the request is started. |
137 void set_load_flags(int load_flags); | 148 void set_load_flags(int load_flags); |
138 | 149 |
139 // Returns the current load flags. | 150 // Returns the current load flags. |
140 int load_flags() const; | 151 int load_flags() const; |
141 | 152 |
142 // Set extra headers on the request. Must be called before the request | 153 // Set extra headers on the request. Must be called before the request |
143 // is started. | 154 // is started. |
144 void set_extra_request_headers(const std::string& extra_request_headers); | 155 void set_extra_request_headers(const std::string& extra_request_headers); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 base::TimeDelta backoff_delay_; | 224 base::TimeDelta backoff_delay_; |
214 // Maximum retries allowed. | 225 // Maximum retries allowed. |
215 int max_retries_; | 226 int max_retries_; |
216 | 227 |
217 static bool g_interception_enabled; | 228 static bool g_interception_enabled; |
218 | 229 |
219 DISALLOW_COPY_AND_ASSIGN(URLFetcher); | 230 DISALLOW_COPY_AND_ASSIGN(URLFetcher); |
220 }; | 231 }; |
221 | 232 |
222 #endif // CHROME_COMMON_NET_URL_FETCHER_H_ | 233 #endif // CHROME_COMMON_NET_URL_FETCHER_H_ |
OLD | NEW |