OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_RESPONSE_HEADERS_H_ | 5 #ifndef NET_HTTP_RESPONSE_HEADERS_H_ |
6 #define NET_HTTP_RESPONSE_HEADERS_H_ | 6 #define NET_HTTP_RESPONSE_HEADERS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 // Extracts the value of the Content-Length header or returns -1 if there is | 195 // Extracts the value of the Content-Length header or returns -1 if there is |
196 // no such header in the response. | 196 // no such header in the response. |
197 int64 GetContentLength() const; | 197 int64 GetContentLength() const; |
198 | 198 |
199 // Returns the HTTP response code. This is 0 if the response code text seems | 199 // Returns the HTTP response code. This is 0 if the response code text seems |
200 // to exist but could not be parsed. Otherwise, it defaults to 200 if the | 200 // to exist but could not be parsed. Otherwise, it defaults to 200 if the |
201 // response code is not found in the raw headers. | 201 // response code is not found in the raw headers. |
202 int response_code() const { return response_code_; } | 202 int response_code() const { return response_code_; } |
203 | 203 |
| 204 // Sets the HTTP response code to the new code. The original HTTP response |
| 205 // code is still available in the raw and parsed headers. |
| 206 void set_response_code(int new_code) { response_code_ = new_code; } |
| 207 |
204 // Returns the raw header string. | 208 // Returns the raw header string. |
205 const std::string& raw_headers() const { return raw_headers_; } | 209 const std::string& raw_headers() const { return raw_headers_; } |
206 | 210 |
207 private: | 211 private: |
208 friend class base::RefCountedThreadSafe<HttpResponseHeaders>; | 212 friend class base::RefCountedThreadSafe<HttpResponseHeaders>; |
209 | 213 |
210 HttpResponseHeaders() {} | 214 HttpResponseHeaders() {} |
211 ~HttpResponseHeaders() {} | 215 ~HttpResponseHeaders() {} |
212 | 216 |
213 // Initializes from the given raw headers. | 217 // Initializes from the given raw headers. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 302 |
299 // The parsed http version number (not normalized). | 303 // The parsed http version number (not normalized). |
300 HttpVersion parsed_http_version_; | 304 HttpVersion parsed_http_version_; |
301 | 305 |
302 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 306 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
303 }; | 307 }; |
304 | 308 |
305 } // namespace net | 309 } // namespace net |
306 | 310 |
307 #endif // NET_HTTP_RESPONSE_HEADERS_H_ | 311 #endif // NET_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |