OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 // Get the HTTP status text of the normalized status line. | 133 // Get the HTTP status text of the normalized status line. |
134 std::string GetStatusText() const; | 134 std::string GetStatusText() const; |
135 | 135 |
136 // Enumerate the "lines" of the response headers. This skips over the status | 136 // Enumerate the "lines" of the response headers. This skips over the status |
137 // line. Use GetStatusLine if you are interested in that. Note that this | 137 // line. Use GetStatusLine if you are interested in that. Note that this |
138 // method returns the un-coalesced response header lines, so if a response | 138 // method returns the un-coalesced response header lines, so if a response |
139 // header appears on multiple lines, then it will appear multiple times in | 139 // header appears on multiple lines, then it will appear multiple times in |
140 // this enumeration (in the order the header lines were received from the | 140 // this enumeration (in the order the header lines were received from the |
141 // server). Initialize a 'void*' variable to NULL and pass it by address to | 141 // server). Also, a given header might have an empty value. Initialize a |
142 // EnumerateHeaderLines. Call EnumerateHeaderLines repeatedly until it | 142 // 'void*' variable to NULL and pass it by address to EnumerateHeaderLines. |
143 // returns false. The out-params 'name' and 'value' are set upon success. | 143 // Call EnumerateHeaderLines repeatedly until it returns false. The |
| 144 // out-params 'name' and 'value' are set upon success. |
144 bool EnumerateHeaderLines(void** iter, | 145 bool EnumerateHeaderLines(void** iter, |
145 std::string* name, | 146 std::string* name, |
146 std::string* value) const; | 147 std::string* value) const; |
147 | 148 |
148 // Enumerate the values of the specified header. If you are only interested | 149 // Enumerate the values of the specified header. If you are only interested |
149 // in the first header, then you can pass NULL for the 'iter' parameter. | 150 // in the first header, then you can pass NULL for the 'iter' parameter. |
150 // Otherwise, to iterate across all values for the specified header, | 151 // Otherwise, to iterate across all values for the specified header, |
151 // initialize a 'void*' variable to NULL and pass it by address to | 152 // initialize a 'void*' variable to NULL and pass it by address to |
152 // EnumerateHeader. Call EnumerateHeader repeatedly until it returns false. | 153 // EnumerateHeader. Note that a header might have an empty value. Call |
| 154 // EnumerateHeader repeatedly until it returns false. |
153 bool EnumerateHeader(void** iter, | 155 bool EnumerateHeader(void** iter, |
154 const std::string& name, | 156 const std::string& name, |
155 std::string* value) const; | 157 std::string* value) const; |
156 | 158 |
157 // Returns true if the response contains the specified header-value pair. | 159 // Returns true if the response contains the specified header-value pair. |
158 // Both name and value are compared case insensitively. | 160 // Both name and value are compared case insensitively. |
159 bool HasHeaderValue(const std::string& name, const std::string& value) const; | 161 bool HasHeaderValue(const std::string& name, const std::string& value) const; |
160 | 162 |
161 // Returns true if the response contains the specified header. | 163 // Returns true if the response contains the specified header. |
162 // The name is compared case insensitively. | 164 // The name is compared case insensitively. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 352 |
351 // The parsed http version number (not normalized). | 353 // The parsed http version number (not normalized). |
352 HttpVersion parsed_http_version_; | 354 HttpVersion parsed_http_version_; |
353 | 355 |
354 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 356 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
355 }; | 357 }; |
356 | 358 |
357 } // namespace net | 359 } // namespace net |
358 | 360 |
359 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 361 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |