Chromium Code Reviews| 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& i, |
|
mmenke
2016/01/19 22:32:24
Also, "i" isn't meaningful name. Maybe just "inde
mmenke
2016/01/19 22:32:24
Passing by non-const reference is forbidden. Use
| |
| 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 bool EnumerateHeader(void** iter, | 179 bool EnumerateHeader(void** iter, |
|
mmenke
2016/01/19 22:32:24
I assume you intend to change this one as well, in
| |
| 180 const base::StringPiece& name, | 180 const base::StringPiece& name, |
| 181 std::string* value) const; | 181 std::string* value) const; |
| 182 | 182 |
| 183 // Returns true if the response contains the specified header-value pair. | 183 // Returns true if the response contains the specified header-value pair. |
| 184 // Both name and value are compared case insensitively. | 184 // Both name and value are compared case insensitively. |
| 185 bool HasHeaderValue(const base::StringPiece& name, | 185 bool HasHeaderValue(const base::StringPiece& name, |
| 186 const base::StringPiece& value) const; | 186 const base::StringPiece& value) const; |
| 187 | 187 |
| 188 // Returns true if the response contains the specified header. | 188 // Returns true if the response contains the specified header. |
| 189 // The name is compared case insensitively. | 189 // The name is compared case insensitively. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 | 401 |
| 402 // The normalized http version (consistent with what GetStatusLine() returns). | 402 // The normalized http version (consistent with what GetStatusLine() returns). |
| 403 HttpVersion http_version_; | 403 HttpVersion http_version_; |
| 404 | 404 |
| 405 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 405 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
| 406 }; | 406 }; |
| 407 | 407 |
| 408 } // namespace net | 408 } // namespace net |
| 409 | 409 |
| 410 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 410 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
| OLD | NEW |