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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 // Get the HTTP status text of the normalized status line. | 157 // Get the HTTP status text of the normalized status line. |
158 std::string GetStatusText() const; | 158 std::string GetStatusText() const; |
159 | 159 |
160 // Enumerate the "lines" of the response headers. This skips over the status | 160 // Enumerate the "lines" of the response headers. This skips over the status |
161 // line. Use GetStatusLine if you are interested in that. Note that this | 161 // line. Use GetStatusLine if you are interested in that. Note that this |
162 // method returns the un-coalesced response header lines, so if a response | 162 // method returns the un-coalesced response header lines, so if a response |
163 // header appears on multiple lines, then it will appear multiple times in | 163 // header appears on multiple lines, then it will appear multiple times in |
164 // this enumeration (in the order the header lines were received from the | 164 // this enumeration (in the order the header lines were received from the |
165 // server). Also, a given header might have an empty value. Initialize a | 165 // server). Also, a given header might have an empty value. Initialize a |
166 // 'void*' variable to NULL and pass it by address to EnumerateHeaderLines. | 166 // 'size_t' variable to 0 and pass it by address to EnumerateHeaderLines. |
167 // Call EnumerateHeaderLines repeatedly until it returns false. The | 167 // Call EnumerateHeaderLines repeatedly until it returns false. The |
168 // out-params 'name' and 'value' are set upon success. | 168 // out-params 'name' and 'value' are set upon success. |
169 bool EnumerateHeaderLines(void** iter, | 169 bool EnumerateHeaderLines(size_t* iter, |
170 std::string* name, | 170 std::string* name, |
171 std::string* value) const; | 171 std::string* value) const; |
172 | 172 |
173 // Enumerate the values of the specified header. If you are only interested | 173 // Enumerate the values of the specified header. If you are only interested |
174 // in the first header, then you can pass NULL for the 'iter' parameter. | 174 // in the first header, then you can pass NULL for the 'iter' parameter. |
175 // Otherwise, to iterate across all values for the specified header, | 175 // Otherwise, to iterate across all values for the specified header, |
176 // initialize a 'void*' variable to NULL and pass it by address to | 176 // initialize a 'void*' variable to NULL and pass it by address to |
177 // EnumerateHeader. Note that a header might have an empty value. Call | 177 // EnumerateHeader. Note that a header might have an empty value. Call |
178 // EnumerateHeader repeatedly until it returns false. | 178 // EnumerateHeader repeatedly until it returns false. |
| 179 // TODO(Olli Raula) Remove void** |
179 bool EnumerateHeader(void** iter, | 180 bool EnumerateHeader(void** iter, |
180 const base::StringPiece& name, | 181 const base::StringPiece& name, |
181 std::string* value) const; | 182 std::string* value) const; |
182 | 183 |
183 // Returns true if the response contains the specified header-value pair. | 184 // Returns true if the response contains the specified header-value pair. |
184 // Both name and value are compared case insensitively. | 185 // Both name and value are compared case insensitively. |
185 bool HasHeaderValue(const base::StringPiece& name, | 186 bool HasHeaderValue(const base::StringPiece& name, |
186 const base::StringPiece& value) const; | 187 const base::StringPiece& value) const; |
187 | 188 |
188 // Returns true if the response contains the specified header. | 189 // Returns true if the response contains the specified header. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 402 |
402 // The normalized http version (consistent with what GetStatusLine() returns). | 403 // The normalized http version (consistent with what GetStatusLine() returns). |
403 HttpVersion http_version_; | 404 HttpVersion http_version_; |
404 | 405 |
405 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 406 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
406 }; | 407 }; |
407 | 408 |
408 } // namespace net | 409 } // namespace net |
409 | 410 |
410 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 411 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |