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

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

Issue 1481143002: Added HttpUtils::HasValidators and HttpResponse::HasValidators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarified the documentation Created 4 years, 9 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_response_headers_unittest.cc ('k') | net/http/http_util.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_UTIL_H_ 5 #ifndef NET_HTTP_HTTP_UTIL_H_
6 #define NET_HTTP_HTTP_UTIL_H_ 6 #define NET_HTTP_HTTP_UTIL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 const std::string& raw_language_list); 198 const std::string& raw_language_list);
199 199
200 // Helper. If |*headers| already contains |header_name| do nothing, 200 // Helper. If |*headers| already contains |header_name| do nothing,
201 // otherwise add <header_name> ": " <header_value> to the end of the list. 201 // otherwise add <header_name> ": " <header_value> to the end of the list.
202 static void AppendHeaderIfMissing(const char* header_name, 202 static void AppendHeaderIfMissing(const char* header_name,
203 const std::string& header_value, 203 const std::string& header_value,
204 std::string* headers); 204 std::string* headers);
205 205
206 // Returns true if the parameters describe a response with a strong etag or 206 // Returns true if the parameters describe a response with a strong etag or
207 // last-modified header. See section 13.3.3 of RFC 2616. 207 // last-modified header. See section 13.3.3 of RFC 2616.
208 // An empty string should be passed for missing headers.
208 static bool HasStrongValidators(HttpVersion version, 209 static bool HasStrongValidators(HttpVersion version,
209 const std::string& etag_header, 210 const std::string& etag_header,
210 const std::string& last_modified_header, 211 const std::string& last_modified_header,
211 const std::string& date_header); 212 const std::string& date_header);
212 213
214 // Returns true if this response has any validator (either a Last-Modified or
215 // an ETag) regardless of whether it is strong or weak. See section 13.3.3 of
216 // RFC 2616.
217 // An empty string should be passed for missing headers.
218 static bool HasValidators(HttpVersion version,
219 const std::string& etag_header,
220 const std::string& last_modified_header);
221
213 // Gets a vector of common HTTP status codes for histograms of status 222 // Gets a vector of common HTTP status codes for histograms of status
214 // codes. Currently returns everything in the range [100, 600), plus 0 223 // codes. Currently returns everything in the range [100, 600), plus 0
215 // (for invalid responses/status codes). 224 // (for invalid responses/status codes).
216 static std::vector<int> GetStatusCodesForHistogram(); 225 static std::vector<int> GetStatusCodesForHistogram();
217 226
218 // Maps an HTTP status code to one of the status codes in the vector 227 // Maps an HTTP status code to one of the status codes in the vector
219 // returned by GetStatusCodesForHistogram. 228 // returned by GetStatusCodesForHistogram.
220 static int MapStatusCodeForHistogram(int code); 229 static int MapStatusCodeForHistogram(int code);
221 230
222 // Used to iterate over the name/value pairs of HTTP headers. To iterate 231 // Used to iterate over the name/value pairs of HTTP headers. To iterate
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 399
391 // True if values are required for each name/value pair; false if a 400 // True if values are required for each name/value pair; false if a
392 // name is permitted to appear without a corresponding value. 401 // name is permitted to appear without a corresponding value.
393 bool values_optional_; 402 bool values_optional_;
394 }; 403 };
395 }; 404 };
396 405
397 } // namespace net 406 } // namespace net
398 407
399 #endif // NET_HTTP_HTTP_UTIL_H_ 408 #endif // NET_HTTP_HTTP_UTIL_H_
OLDNEW
« no previous file with comments | « net/http/http_response_headers_unittest.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698