| 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 // HttpRequestHeaders manages the request headers. | 5 // HttpRequestHeaders manages the request headers. |
| 6 // It maintains these in a vector of header key/value pairs, thereby maintaining | 6 // It maintains these in a vector of header key/value pairs, thereby maintaining |
| 7 // the order of the headers. This means that any lookups are linear time | 7 // the order of the headers. This means that any lookups are linear time |
| 8 // operations. | 8 // operations. |
| 9 | 9 |
| 10 #ifndef NET_HTTP_HTTP_REQUEST_HEADERS_H_ | 10 #ifndef NET_HTTP_HTTP_REQUEST_HEADERS_H_ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Gets the first header that matches |key|. If found, returns true and | 93 // Gets the first header that matches |key|. If found, returns true and |
| 94 // writes the value to |out|. | 94 // writes the value to |out|. |
| 95 bool GetHeader(const base::StringPiece& key, std::string* out) const; | 95 bool GetHeader(const base::StringPiece& key, std::string* out) const; |
| 96 | 96 |
| 97 // Clears all the headers. | 97 // Clears all the headers. |
| 98 void Clear(); | 98 void Clear(); |
| 99 | 99 |
| 100 // Sets the header value pair for |key| and |value|. If |key| already exists, | 100 // Sets the header value pair for |key| and |value|. If |key| already exists, |
| 101 // then the header value is modified, but the key is untouched, and the order | 101 // then the header value is modified, but the key is untouched, and the order |
| 102 // in the vector remains the same. When comparing |key|, case is ignored. | 102 // in the vector remains the same. When comparing |key|, case is ignored. |
| 103 // The caller must ensure that |key| passes HttpUtil::IsValidHeaderName() and |
| 104 // |value| passes HttpUtil::IsValidHeaderValue(). |
| 103 void SetHeader(const base::StringPiece& key, const base::StringPiece& value); | 105 void SetHeader(const base::StringPiece& key, const base::StringPiece& value); |
| 104 | 106 |
| 105 // Sets the header value pair for |key| and |value|, if |key| does not exist. | 107 // Sets the header value pair for |key| and |value|, if |key| does not exist. |
| 106 // If |key| already exists, the call is a no-op. | 108 // If |key| already exists, the call is a no-op. |
| 107 // When comparing |key|, case is ignored. | 109 // When comparing |key|, case is ignored. |
| 108 void SetHeaderIfMissing(const base::StringPiece& key, | 110 void SetHeaderIfMissing(const base::StringPiece& key, |
| 109 const base::StringPiece& value); | 111 const base::StringPiece& value); |
| 110 | 112 |
| 111 // Removes the first header that matches (case insensitive) |key|. | 113 // Removes the first header that matches (case insensitive) |key|. |
| 112 void RemoveHeader(const base::StringPiece& key); | 114 void RemoveHeader(const base::StringPiece& key); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Allow the copy construction and operator= to facilitate copying in | 177 // Allow the copy construction and operator= to facilitate copying in |
| 176 // HttpRequestHeaders. | 178 // HttpRequestHeaders. |
| 177 // TODO(willchan): Investigate to see if we can remove the need to copy | 179 // TODO(willchan): Investigate to see if we can remove the need to copy |
| 178 // HttpRequestHeaders. | 180 // HttpRequestHeaders. |
| 179 // DISALLOW_COPY_AND_ASSIGN(HttpRequestHeaders); | 181 // DISALLOW_COPY_AND_ASSIGN(HttpRequestHeaders); |
| 180 }; | 182 }; |
| 181 | 183 |
| 182 } // namespace net | 184 } // namespace net |
| 183 | 185 |
| 184 #endif // NET_HTTP_HTTP_REQUEST_HEADERS_H_ | 186 #endif // NET_HTTP_HTTP_REQUEST_HEADERS_H_ |
| OLD | NEW |