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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Appends a representation of this object to the given pickle. | 56 // Appends a representation of this object to the given pickle. |
57 // The options argument can be a combination of PersistOptions. | 57 // The options argument can be a combination of PersistOptions. |
58 void Persist(Pickle* pickle, PersistOptions options); | 58 void Persist(Pickle* pickle, PersistOptions options); |
59 | 59 |
60 // Performs header merging as described in 13.5.3 of RFC 2616. | 60 // Performs header merging as described in 13.5.3 of RFC 2616. |
61 void Update(const HttpResponseHeaders& new_headers); | 61 void Update(const HttpResponseHeaders& new_headers); |
62 | 62 |
63 // Removes all instances of a particular header. | 63 // Removes all instances of a particular header. |
64 void RemoveHeader(const std::string& name); | 64 void RemoveHeader(const std::string& name); |
65 | 65 |
| 66 // Removes a particular header. The header name is compared |
| 67 // case-insensitively. |
| 68 void RemoveHeaderWithValue(const std::string& name, const std::string& value); |
| 69 |
66 // Adds a particular header. |header| has to be a single header without any | 70 // Adds a particular header. |header| has to be a single header without any |
67 // EOL termination, just [<header-name>: <header-values>] | 71 // EOL termination, just [<header-name>: <header-values>] |
68 // If a header with the same name is already stored, the two headers are not | 72 // If a header with the same name is already stored, the two headers are not |
69 // merged together by this method; the one provided is simply put at the | 73 // merged together by this method; the one provided is simply put at the |
70 // end of the list. | 74 // end of the list. |
71 void AddHeader(const std::string& header); | 75 void AddHeader(const std::string& header); |
72 | 76 |
73 // Replaces the current status line with the provided one (|new_status| should | 77 // Replaces the current status line with the provided one (|new_status| should |
74 // not have any EOL). | 78 // not have any EOL). |
75 void ReplaceStatusLine(const std::string& new_status); | 79 void ReplaceStatusLine(const std::string& new_status); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 std::string::const_iterator value_begin, | 297 std::string::const_iterator value_begin, |
294 std::string::const_iterator value_end); | 298 std::string::const_iterator value_end); |
295 | 299 |
296 // Replaces the current headers with the merged version of |raw_headers| and | 300 // Replaces the current headers with the merged version of |raw_headers| and |
297 // the current headers without the headers in |headers_to_remove|. Note that | 301 // the current headers without the headers in |headers_to_remove|. Note that |
298 // |headers_to_remove| are removed from the current headers (before the | 302 // |headers_to_remove| are removed from the current headers (before the |
299 // merge), not after the merge. | 303 // merge), not after the merge. |
300 void MergeWithHeaders(const std::string& raw_headers, | 304 void MergeWithHeaders(const std::string& raw_headers, |
301 const HeaderSet& headers_to_remove); | 305 const HeaderSet& headers_to_remove); |
302 | 306 |
| 307 // Replaces the current headers with the merged version of |raw_headers| and |
| 308 // the current headers with out the header consisting of |
| 309 // |header_to_remove_name| and |header_to_remove_value|. Note that |
| 310 // |header_to_remove_name| is compared case-insensitively. |
| 311 // Note that the header to remove is removed from the current headers (before |
| 312 // the merge), not after the merge. |
| 313 void MergeWithHeadersWithValue(const std::string& raw_headers, |
| 314 const std::string& header_to_remove_name, |
| 315 const std::string& header_to_remove_value); |
| 316 |
303 // Adds the values from any 'cache-control: no-cache="foo,bar"' headers. | 317 // Adds the values from any 'cache-control: no-cache="foo,bar"' headers. |
304 void AddNonCacheableHeaders(HeaderSet* header_names) const; | 318 void AddNonCacheableHeaders(HeaderSet* header_names) const; |
305 | 319 |
306 // Adds the set of header names that contain cookie values. | 320 // Adds the set of header names that contain cookie values. |
307 static void AddSensitiveHeaders(HeaderSet* header_names); | 321 static void AddSensitiveHeaders(HeaderSet* header_names); |
308 | 322 |
309 // Adds the set of rfc2616 hop-by-hop response headers. | 323 // Adds the set of rfc2616 hop-by-hop response headers. |
310 static void AddHopByHopHeaders(HeaderSet* header_names); | 324 static void AddHopByHopHeaders(HeaderSet* header_names); |
311 | 325 |
312 // Adds the set of challenge response headers. | 326 // Adds the set of challenge response headers. |
(...skipping 25 matching lines...) Expand all Loading... |
338 | 352 |
339 // The parsed http version number (not normalized). | 353 // The parsed http version number (not normalized). |
340 HttpVersion parsed_http_version_; | 354 HttpVersion parsed_http_version_; |
341 | 355 |
342 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 356 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
343 }; | 357 }; |
344 | 358 |
345 } // namespace net | 359 } // namespace net |
346 | 360 |
347 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 361 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |