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); |
32 ~HttpBasicState(); | 33 ~HttpBasicState(); |
33 | 34 |
34 // Initialize() must be called before using any of the other methods. | 35 // Initialize() must be called before using any of the other methods. |
35 int Initialize(const HttpRequestInfo* request_info, | 36 int Initialize(const HttpRequestInfo* request_info, |
36 RequestPriority priority, | 37 RequestPriority priority, |
37 const BoundNetLog& net_log, | 38 const BoundNetLog& net_log, |
38 const CompletionCallback& callback); | 39 const CompletionCallback& callback); |
39 | 40 |
40 HttpStreamParser* parser() const { return parser_.get(); } | 41 HttpStreamParser* parser() const { return parser_.get(); } |
41 | 42 |
42 bool using_proxy() const { return using_proxy_; } | 43 bool using_proxy() const { return using_proxy_; } |
43 | 44 |
| 45 bool http_09_on_non_default_ports_enabled() const { |
| 46 return http_09_on_non_default_ports_enabled_; |
| 47 } |
| 48 |
44 // Deletes |parser_| and sets it to NULL. | 49 // Deletes |parser_| and sets it to NULL. |
45 void DeleteParser(); | 50 void DeleteParser(); |
46 | 51 |
47 ClientSocketHandle* connection() const { return connection_.get(); } | 52 ClientSocketHandle* connection() const { return connection_.get(); } |
48 | 53 |
49 std::unique_ptr<ClientSocketHandle> ReleaseConnection(); | 54 std::unique_ptr<ClientSocketHandle> ReleaseConnection(); |
50 | 55 |
51 scoped_refptr<GrowableIOBuffer> read_buf() const; | 56 scoped_refptr<GrowableIOBuffer> read_buf() const; |
52 | 57 |
53 // Generates a string of the form "METHOD PATH HTTP/1.1\r\n", based on the | 58 // Generates a string of the form "METHOD PATH HTTP/1.1\r\n", based on the |
54 // values of request_info_ and using_proxy_. | 59 // values of request_info_ and using_proxy_. |
55 std::string GenerateRequestLine() const; | 60 std::string GenerateRequestLine() const; |
56 | 61 |
57 private: | 62 private: |
58 scoped_refptr<GrowableIOBuffer> read_buf_; | 63 scoped_refptr<GrowableIOBuffer> read_buf_; |
59 | 64 |
60 std::unique_ptr<HttpStreamParser> parser_; | 65 std::unique_ptr<HttpStreamParser> parser_; |
61 | 66 |
62 std::unique_ptr<ClientSocketHandle> connection_; | 67 std::unique_ptr<ClientSocketHandle> connection_; |
63 | 68 |
64 const bool using_proxy_; | 69 const bool using_proxy_; |
65 | 70 |
| 71 const bool http_09_on_non_default_ports_enabled_; |
| 72 |
66 const HttpRequestInfo* request_info_; | 73 const HttpRequestInfo* request_info_; |
67 | 74 |
68 DISALLOW_COPY_AND_ASSIGN(HttpBasicState); | 75 DISALLOW_COPY_AND_ASSIGN(HttpBasicState); |
69 }; | 76 }; |
70 | 77 |
71 } // namespace net | 78 } // namespace net |
72 | 79 |
73 #endif // NET_HTTP_HTTP_BASIC_STATE_H_ | 80 #endif // NET_HTTP_HTTP_BASIC_STATE_H_ |
OLD | NEW |