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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Appends a representation of this object to the given pickle. | 58 // Appends a representation of this object to the given pickle. |
59 // The options argument can be a combination of PersistOptions. | 59 // The options argument can be a combination of PersistOptions. |
60 void Persist(Pickle* pickle, PersistOptions options); | 60 void Persist(Pickle* pickle, PersistOptions options); |
61 | 61 |
62 // Performs header merging as described in 13.5.3 of RFC 2616. | 62 // Performs header merging as described in 13.5.3 of RFC 2616. |
63 void Update(const HttpResponseHeaders& new_headers); | 63 void Update(const HttpResponseHeaders& new_headers); |
64 | 64 |
65 // Removes all instances of a particular header. | 65 // Removes all instances of a particular header. |
66 void RemoveHeader(const std::string& name); | 66 void RemoveHeader(const std::string& name); |
67 | 67 |
68 // Removes a particular header. The header name is compared | 68 // Removes a particular header line. The header name is compared |
69 // case-insensitively. | 69 // case-insensitively. |
70 void RemoveHeaderWithValue(const std::string& name, const std::string& value); | 70 void RemoveHeaderLine(const std::string& name, const std::string& value); |
71 | 71 |
72 // Adds a particular header. |header| has to be a single header without any | 72 // Adds a particular header. |header| has to be a single header without any |
73 // EOL termination, just [<header-name>: <header-values>] | 73 // EOL termination, just [<header-name>: <header-values>] |
74 // If a header with the same name is already stored, the two headers are not | 74 // If a header with the same name is already stored, the two headers are not |
75 // merged together by this method; the one provided is simply put at the | 75 // merged together by this method; the one provided is simply put at the |
76 // end of the list. | 76 // end of the list. |
77 void AddHeader(const std::string& header); | 77 void AddHeader(const std::string& header); |
78 | 78 |
79 // Replaces the current status line with the provided one (|new_status| should | 79 // Replaces the current status line with the provided one (|new_status| should |
80 // not have any EOL). | 80 // not have any EOL). |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 std::string::const_iterator value_begin, | 314 std::string::const_iterator value_begin, |
315 std::string::const_iterator value_end); | 315 std::string::const_iterator value_end); |
316 | 316 |
317 // Replaces the current headers with the merged version of |raw_headers| and | 317 // Replaces the current headers with the merged version of |raw_headers| and |
318 // the current headers without the headers in |headers_to_remove|. Note that | 318 // the current headers without the headers in |headers_to_remove|. Note that |
319 // |headers_to_remove| are removed from the current headers (before the | 319 // |headers_to_remove| are removed from the current headers (before the |
320 // merge), not after the merge. | 320 // merge), not after the merge. |
321 void MergeWithHeaders(const std::string& raw_headers, | 321 void MergeWithHeaders(const std::string& raw_headers, |
322 const HeaderSet& headers_to_remove); | 322 const HeaderSet& headers_to_remove); |
323 | 323 |
324 // Replaces the current headers with the merged version of |raw_headers| and | |
325 // the current headers with out the header consisting of | |
326 // |header_to_remove_name| and |header_to_remove_value|. Note that | |
327 // |header_to_remove_name| is compared case-insensitively. | |
328 // Note that the header to remove is removed from the current headers (before | |
329 // the merge), not after the merge. | |
330 void MergeWithHeadersWithValue(const std::string& raw_headers, | |
331 const std::string& header_to_remove_name, | |
332 const std::string& header_to_remove_value); | |
333 | |
334 // Adds the values from any 'cache-control: no-cache="foo,bar"' headers. | 324 // Adds the values from any 'cache-control: no-cache="foo,bar"' headers. |
335 void AddNonCacheableHeaders(HeaderSet* header_names) const; | 325 void AddNonCacheableHeaders(HeaderSet* header_names) const; |
336 | 326 |
337 // Adds the set of header names that contain cookie values. | 327 // Adds the set of header names that contain cookie values. |
338 static void AddSensitiveHeaders(HeaderSet* header_names); | 328 static void AddSensitiveHeaders(HeaderSet* header_names); |
339 | 329 |
340 // Adds the set of rfc2616 hop-by-hop response headers. | 330 // Adds the set of rfc2616 hop-by-hop response headers. |
341 static void AddHopByHopHeaders(HeaderSet* header_names); | 331 static void AddHopByHopHeaders(HeaderSet* header_names); |
342 | 332 |
343 // Adds the set of challenge response headers. | 333 // Adds the set of challenge response headers. |
(...skipping 28 matching lines...) Expand all Loading... |
372 | 362 |
373 // The parsed http version number (not normalized). | 363 // The parsed http version number (not normalized). |
374 HttpVersion parsed_http_version_; | 364 HttpVersion parsed_http_version_; |
375 | 365 |
376 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 366 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
377 }; | 367 }; |
378 | 368 |
379 } // namespace net | 369 } // namespace net |
380 | 370 |
381 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 371 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |