OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 5 #ifndef NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 bool GetCharset(std::string* charset) const; | 183 bool GetCharset(std::string* charset) const; |
184 | 184 |
185 // Returns true if this response corresponds to a redirect. The target | 185 // Returns true if this response corresponds to a redirect. The target |
186 // location of the redirect is optionally returned if location is non-null. | 186 // location of the redirect is optionally returned if location is non-null. |
187 bool IsRedirect(std::string* location) const; | 187 bool IsRedirect(std::string* location) const; |
188 | 188 |
189 // Returns true if the HTTP response code passed in corresponds to a | 189 // Returns true if the HTTP response code passed in corresponds to a |
190 // redirect. | 190 // redirect. |
191 static bool IsRedirectResponseCode(int response_code); | 191 static bool IsRedirectResponseCode(int response_code); |
192 | 192 |
193 // Returns true if the response cannot be reused without validation. The | 193 // Returns the time from which this resource can no longer be reused without |
194 // result is relative to the current_time parameter, which is a parameter to | 194 // validation. |request_time| is the local time at which the request that |
195 // support unit testing. The request_time parameter indicates the time at | 195 // resulted in this response was made. |response_time| is the local time at |
196 // which the request was made that resulted in this response, which was | 196 // which we received this response. |
197 // received at response_time. | 197 base::Time GetFreshnessExpiry(base::Time request_time, |
darin (slow to review)
2014/02/26 05:51:07
nit: Wouldn't this more canonically be called GetE
gavinp
2014/02/26 17:12:28
Yes, that's a more canonical name. There's no reas
| |
198 bool RequiresValidation(const base::Time& request_time, | 198 base::Time response_time) const; |
199 const base::Time& response_time, | |
200 const base::Time& current_time) const; | |
201 | 199 |
202 // Returns the amount of time the server claims the response is fresh from | 200 // Returns the amount of time the server claims the response is fresh from |
203 // the time the response was generated. See section 13.2.4 of RFC 2616. See | 201 // the time the response was generated. See section 13.2.4 of RFC 2616. See |
204 // RequiresValidation for a description of the response_time parameter. | 202 // RequiresValidation for a description of the response_time parameter. |
205 base::TimeDelta GetFreshnessLifetime(const base::Time& response_time) const; | 203 base::TimeDelta GetFreshnessLifetime(base::Time response_time) const; |
206 | |
207 // Returns the age of the response. See section 13.2.3 of RFC 2616. | |
208 // See RequiresValidation for a description of this method's parameters. | |
209 base::TimeDelta GetCurrentAge(const base::Time& request_time, | |
210 const base::Time& response_time, | |
211 const base::Time& current_time) const; | |
212 | 204 |
213 // The following methods extract values from the response headers. If a | 205 // The following methods extract values from the response headers. If a |
214 // value is not present, then false is returned. Otherwise, true is returned | 206 // value is not present, then false is returned. Otherwise, true is returned |
215 // and the out param is assigned to the corresponding value. | 207 // and the out param is assigned to the corresponding value. |
216 bool GetMaxAgeValue(base::TimeDelta* value) const; | 208 bool GetMaxAgeValue(base::TimeDelta* value) const; |
217 bool GetAgeValue(base::TimeDelta* value) const; | 209 bool GetAgeValue(base::TimeDelta* value) const; |
218 bool GetDateValue(base::Time* value) const; | 210 bool GetDateValue(base::Time* value) const; |
219 bool GetLastModifiedValue(base::Time* value) const; | 211 bool GetLastModifiedValue(base::Time* value) const; |
220 bool GetExpiresValue(base::Time* value) const; | 212 bool GetExpiresValue(base::Time* value) const; |
221 | 213 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 | 394 |
403 // The parsed http version number (not normalized). | 395 // The parsed http version number (not normalized). |
404 HttpVersion parsed_http_version_; | 396 HttpVersion parsed_http_version_; |
405 | 397 |
406 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 398 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
407 }; | 399 }; |
408 | 400 |
409 } // namespace net | 401 } // namespace net |
410 | 402 |
411 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 403 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |