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 |
11 #include <string> | 11 #include <string> |
12 #include <unordered_set> | |
13 #include <vector> | 12 #include <vector> |
14 | 13 |
| 14 #include "base/containers/hash_tables.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
19 #include "net/http/http_version.h" | 19 #include "net/http/http_version.h" |
20 #include "net/log/net_log.h" | 20 #include "net/log/net_log.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class Pickle; | 23 class Pickle; |
24 class PickleIterator; | 24 class PickleIterator; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // to exist but could not be parsed. Otherwise, it defaults to 200 if the | 316 // to exist but could not be parsed. Otherwise, it defaults to 200 if the |
317 // response code is not found in the raw headers. | 317 // response code is not found in the raw headers. |
318 int response_code() const { return response_code_; } | 318 int response_code() const { return response_code_; } |
319 | 319 |
320 // Returns the raw header string. | 320 // Returns the raw header string. |
321 const std::string& raw_headers() const { return raw_headers_; } | 321 const std::string& raw_headers() const { return raw_headers_; } |
322 | 322 |
323 private: | 323 private: |
324 friend class base::RefCountedThreadSafe<HttpResponseHeaders>; | 324 friend class base::RefCountedThreadSafe<HttpResponseHeaders>; |
325 | 325 |
326 using HeaderSet = std::unordered_set<std::string>; | 326 typedef base::hash_set<std::string> HeaderSet; |
327 | 327 |
328 // The members of this structure point into raw_headers_. | 328 // The members of this structure point into raw_headers_. |
329 struct ParsedHeader; | 329 struct ParsedHeader; |
330 typedef std::vector<ParsedHeader> HeaderList; | 330 typedef std::vector<ParsedHeader> HeaderList; |
331 | 331 |
332 HttpResponseHeaders(); | 332 HttpResponseHeaders(); |
333 ~HttpResponseHeaders(); | 333 ~HttpResponseHeaders(); |
334 | 334 |
335 // Initializes from the given raw headers. | 335 // Initializes from the given raw headers. |
336 void Parse(const std::string& raw_input); | 336 void Parse(const std::string& raw_input); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 // The normalized http version (consistent with what GetStatusLine() returns). | 422 // The normalized http version (consistent with what GetStatusLine() returns). |
423 HttpVersion http_version_; | 423 HttpVersion http_version_; |
424 | 424 |
425 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 425 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
426 }; | 426 }; |
427 | 427 |
428 } // namespace net | 428 } // namespace net |
429 | 429 |
430 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 430 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |