OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // A class that stores the common state between HttpBasicStream and | 5 // A class that stores the common state between HttpBasicStream and |
6 // WebSocketBasicHandshakeStream. | 6 // WebSocketBasicHandshakeStream. |
7 | 7 |
8 #ifndef NET_HTTP_HTTP_BASIC_STATE_H_ | 8 #ifndef NET_HTTP_HTTP_BASIC_STATE_H_ |
9 #define NET_HTTP_HTTP_BASIC_STATE_H_ | 9 #define NET_HTTP_HTTP_BASIC_STATE_H_ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class BoundNetLog; | 22 class BoundNetLog; |
23 class ClientSocketHandle; | 23 class ClientSocketHandle; |
24 class GrowableIOBuffer; | 24 class GrowableIOBuffer; |
25 class HttpStreamParser; | 25 class HttpStreamParser; |
26 struct HttpRequestInfo; | 26 struct HttpRequestInfo; |
27 | 27 |
28 class NET_EXPORT_PRIVATE HttpBasicState { | 28 class NET_EXPORT_PRIVATE HttpBasicState { |
29 public: | 29 public: |
30 HttpBasicState(std::unique_ptr<ClientSocketHandle> connection, | 30 HttpBasicState(std::unique_ptr<ClientSocketHandle> connection, |
31 bool using_proxy, | 31 bool using_proxy); |
32 bool http_09_on_non_default_ports_enabled); | |
33 ~HttpBasicState(); | 32 ~HttpBasicState(); |
34 | 33 |
35 // Initialize() must be called before using any of the other methods. | 34 // Initialize() must be called before using any of the other methods. |
36 int Initialize(const HttpRequestInfo* request_info, | 35 int Initialize(const HttpRequestInfo* request_info, |
37 RequestPriority priority, | 36 RequestPriority priority, |
38 const BoundNetLog& net_log, | 37 const BoundNetLog& net_log, |
39 const CompletionCallback& callback); | 38 const CompletionCallback& callback); |
40 | 39 |
41 HttpStreamParser* parser() const { return parser_.get(); } | 40 HttpStreamParser* parser() const { return parser_.get(); } |
42 | 41 |
43 bool using_proxy() const { return using_proxy_; } | 42 bool using_proxy() const { return using_proxy_; } |
44 | 43 |
45 bool http_09_on_non_default_ports_enabled() const { | |
46 return http_09_on_non_default_ports_enabled_; | |
47 } | |
48 | |
49 // Deletes |parser_| and sets it to NULL. | 44 // Deletes |parser_| and sets it to NULL. |
50 void DeleteParser(); | 45 void DeleteParser(); |
51 | 46 |
52 ClientSocketHandle* connection() const { return connection_.get(); } | 47 ClientSocketHandle* connection() const { return connection_.get(); } |
53 | 48 |
54 std::unique_ptr<ClientSocketHandle> ReleaseConnection(); | 49 std::unique_ptr<ClientSocketHandle> ReleaseConnection(); |
55 | 50 |
56 scoped_refptr<GrowableIOBuffer> read_buf() const; | 51 scoped_refptr<GrowableIOBuffer> read_buf() const; |
57 | 52 |
58 // Generates a string of the form "METHOD PATH HTTP/1.1\r\n", based on the | 53 // Generates a string of the form "METHOD PATH HTTP/1.1\r\n", based on the |
59 // values of request_info_ and using_proxy_. | 54 // values of request_info_ and using_proxy_. |
60 std::string GenerateRequestLine() const; | 55 std::string GenerateRequestLine() const; |
61 | 56 |
62 private: | 57 private: |
63 scoped_refptr<GrowableIOBuffer> read_buf_; | 58 scoped_refptr<GrowableIOBuffer> read_buf_; |
64 | 59 |
65 std::unique_ptr<HttpStreamParser> parser_; | 60 std::unique_ptr<HttpStreamParser> parser_; |
66 | 61 |
67 std::unique_ptr<ClientSocketHandle> connection_; | 62 std::unique_ptr<ClientSocketHandle> connection_; |
68 | 63 |
69 const bool using_proxy_; | 64 const bool using_proxy_; |
70 | 65 |
71 const bool http_09_on_non_default_ports_enabled_; | |
72 | |
73 const HttpRequestInfo* request_info_; | 66 const HttpRequestInfo* request_info_; |
74 | 67 |
75 DISALLOW_COPY_AND_ASSIGN(HttpBasicState); | 68 DISALLOW_COPY_AND_ASSIGN(HttpBasicState); |
76 }; | 69 }; |
77 | 70 |
78 } // namespace net | 71 } // namespace net |
79 | 72 |
80 #endif // NET_HTTP_HTTP_BASIC_STATE_H_ | 73 #endif // NET_HTTP_HTTP_BASIC_STATE_H_ |
OLD | NEW |