Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: net/http/http_response_headers.h

Issue 391763002: Initial implementation of Chrome-Freshness header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove const from directive_size. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_response_headers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 const base::Time& current_time) const; 222 const base::Time& current_time) const;
223 223
224 // The following methods extract values from the response headers. If a 224 // The following methods extract values from the response headers. If a
225 // value is not present, then false is returned. Otherwise, true is returned 225 // value is not present, then false is returned. Otherwise, true is returned
226 // and the out param is assigned to the corresponding value. 226 // and the out param is assigned to the corresponding value.
227 bool GetMaxAgeValue(base::TimeDelta* value) const; 227 bool GetMaxAgeValue(base::TimeDelta* value) const;
228 bool GetAgeValue(base::TimeDelta* value) const; 228 bool GetAgeValue(base::TimeDelta* value) const;
229 bool GetDateValue(base::Time* value) const; 229 bool GetDateValue(base::Time* value) const;
230 bool GetLastModifiedValue(base::Time* value) const; 230 bool GetLastModifiedValue(base::Time* value) const;
231 bool GetExpiresValue(base::Time* value) const; 231 bool GetExpiresValue(base::Time* value) const;
232 bool GetStaleWhileRevalidateValue(base::TimeDelta* value) const;
232 233
233 // Extracts the time value of a particular header. This method looks for the 234 // Extracts the time value of a particular header. This method looks for the
234 // first matching header value and parses its value as a HTTP-date. 235 // first matching header value and parses its value as a HTTP-date.
235 bool GetTimeValuedHeader(const std::string& name, base::Time* result) const; 236 bool GetTimeValuedHeader(const std::string& name, base::Time* result) const;
236 237
237 // Determines if this response indicates a keep-alive connection. 238 // Determines if this response indicates a keep-alive connection.
238 bool IsKeepAlive() const; 239 bool IsKeepAlive() const;
239 240
240 // Returns true if this response has a strong etag or last-modified header. 241 // Returns true if this response has a strong etag or last-modified header.
241 // See section 13.3.3 of RFC 2616. 242 // See section 13.3.3 of RFC 2616.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // with line_begin and end pointing at the begin and end of this line. 314 // with line_begin and end pointing at the begin and end of this line.
314 // Output will be a normalized version of this. 315 // Output will be a normalized version of this.
315 void ParseStatusLine(std::string::const_iterator line_begin, 316 void ParseStatusLine(std::string::const_iterator line_begin,
316 std::string::const_iterator line_end, 317 std::string::const_iterator line_end,
317 bool has_headers); 318 bool has_headers);
318 319
319 // Find the header in our list (case-insensitive) starting with parsed_ at 320 // Find the header in our list (case-insensitive) starting with parsed_ at
320 // index |from|. Returns string::npos if not found. 321 // index |from|. Returns string::npos if not found.
321 size_t FindHeader(size_t from, const base::StringPiece& name) const; 322 size_t FindHeader(size_t from, const base::StringPiece& name) const;
322 323
324 // Search the Cache-Control header for a directive matching |directive|. If
325 // present, treat its value as a time offset in seconds, write it to |result|,
326 // and return true.
327 bool GetCacheControlDirective(const base::StringPiece& directive,
328 base::TimeDelta* result) const;
329
323 // Add a header->value pair to our list. If we already have header in our 330 // Add a header->value pair to our list. If we already have header in our
324 // list, append the value to it. 331 // list, append the value to it.
325 void AddHeader(std::string::const_iterator name_begin, 332 void AddHeader(std::string::const_iterator name_begin,
326 std::string::const_iterator name_end, 333 std::string::const_iterator name_end,
327 std::string::const_iterator value_begin, 334 std::string::const_iterator value_begin,
328 std::string::const_iterator value_end); 335 std::string::const_iterator value_end);
329 336
330 // Add to parsed_ given the fields of a ParsedHeader object. 337 // Add to parsed_ given the fields of a ParsedHeader object.
331 void AddToParsed(std::string::const_iterator name_begin, 338 void AddToParsed(std::string::const_iterator name_begin,
332 std::string::const_iterator name_end, 339 std::string::const_iterator name_end,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 388
382 // The parsed http version number (not normalized). 389 // The parsed http version number (not normalized).
383 HttpVersion parsed_http_version_; 390 HttpVersion parsed_http_version_;
384 391
385 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); 392 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders);
386 }; 393 };
387 394
388 } // namespace net 395 } // namespace net
389 396
390 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ 397 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_
OLDNEW
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_response_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698