| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 headers_.swap(other->headers_); | 140 headers_.swap(other->headers_); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Serializes HttpRequestHeaders to a string representation. Joins all the | 143 // Serializes HttpRequestHeaders to a string representation. Joins all the |
| 144 // header keys and values with ": ", and inserts "\r\n" between each header | 144 // header keys and values with ": ", and inserts "\r\n" between each header |
| 145 // line, and adds the trailing "\r\n". | 145 // line, and adds the trailing "\r\n". |
| 146 std::string ToString() const; | 146 std::string ToString() const; |
| 147 | 147 |
| 148 // Takes in the request line and returns a Value for use with the NetLog | 148 // Takes in the request line and returns a Value for use with the NetLog |
| 149 // containing both the request line and all headers fields. | 149 // containing both the request line and all headers fields. |
| 150 base::Value* NetLogCallback(const std::string* request_line, | 150 scoped_ptr<base::Value> NetLogCallback(const std::string* request_line, |
| 151 NetLogCaptureMode capture_mode) const; | 151 NetLogCaptureMode capture_mode) const; |
| 152 | 152 |
| 153 // Takes in a Value created by the above function, and attempts to extract the | 153 // Takes in a Value created by the above function, and attempts to extract the |
| 154 // request line and create a copy of the original headers. Returns true on | 154 // request line and create a copy of the original headers. Returns true on |
| 155 // success. On failure, clears |headers| and |request_line|. | 155 // success. On failure, clears |headers| and |request_line|. |
| 156 // TODO(mmenke): Long term, we want to remove this, and migrate external | 156 // TODO(mmenke): Long term, we want to remove this, and migrate external |
| 157 // consumers to be NetworkDelegates. | 157 // consumers to be NetworkDelegates. |
| 158 static bool FromNetLogParam(const base::Value* event_param, | 158 static bool FromNetLogParam(const base::Value* event_param, |
| 159 HttpRequestHeaders* headers, | 159 HttpRequestHeaders* headers, |
| 160 std::string* request_line); | 160 std::string* request_line); |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 HeaderVector::iterator FindHeader(const base::StringPiece& key); | 163 HeaderVector::iterator FindHeader(const base::StringPiece& key); |
| 164 HeaderVector::const_iterator FindHeader(const base::StringPiece& key) const; | 164 HeaderVector::const_iterator FindHeader(const base::StringPiece& key) const; |
| 165 | 165 |
| 166 HeaderVector headers_; | 166 HeaderVector headers_; |
| 167 | 167 |
| 168 // Allow the copy construction and operator= to facilitate copying in | 168 // Allow the copy construction and operator= to facilitate copying in |
| 169 // HttpRequestHeaders. | 169 // HttpRequestHeaders. |
| 170 // TODO(willchan): Investigate to see if we can remove the need to copy | 170 // TODO(willchan): Investigate to see if we can remove the need to copy |
| 171 // HttpRequestHeaders. | 171 // HttpRequestHeaders. |
| 172 // DISALLOW_COPY_AND_ASSIGN(HttpRequestHeaders); | 172 // DISALLOW_COPY_AND_ASSIGN(HttpRequestHeaders); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 } // namespace net | 175 } // namespace net |
| 176 | 176 |
| 177 #endif // NET_HTTP_HTTP_REQUEST_HEADERS_H_ | 177 #endif // NET_HTTP_HTTP_REQUEST_HEADERS_H_ |
| OLD | NEW |