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 #include "net/http/http_basic_stream.h" | 5 #include "net/http/http_basic_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "net/http/http_request_info.h" | 9 #include "net/http/http_request_info.h" |
10 #include "net/http/http_response_body_drainer.h" | 10 #include "net/http/http_response_body_drainer.h" |
11 #include "net/http/http_stream_parser.h" | 11 #include "net/http/http_stream_parser.h" |
12 #include "net/socket/client_socket_handle.h" | 12 #include "net/socket/client_socket_handle.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 HttpBasicStream::HttpBasicStream(std::unique_ptr<ClientSocketHandle> connection, | 16 HttpBasicStream::HttpBasicStream(std::unique_ptr<ClientSocketHandle> connection, |
17 bool using_proxy, | 17 bool using_proxy) |
18 bool http_09_on_non_default_ports_enabled) | 18 : state_(std::move(connection), using_proxy) {} |
19 : state_(std::move(connection), | |
20 using_proxy, | |
21 http_09_on_non_default_ports_enabled) {} | |
22 | 19 |
23 HttpBasicStream::~HttpBasicStream() {} | 20 HttpBasicStream::~HttpBasicStream() {} |
24 | 21 |
25 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, | 22 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, |
26 RequestPriority priority, | 23 RequestPriority priority, |
27 const BoundNetLog& net_log, | 24 const BoundNetLog& net_log, |
28 const CompletionCallback& callback) { | 25 const CompletionCallback& callback) { |
29 state_.Initialize(request_info, priority, net_log, callback); | 26 state_.Initialize(request_info, priority, net_log, callback); |
30 return OK; | 27 return OK; |
31 } | 28 } |
(...skipping 24 matching lines...) Expand all Loading... |
56 parser()->Close(not_reusable); | 53 parser()->Close(not_reusable); |
57 } | 54 } |
58 | 55 |
59 HttpStream* HttpBasicStream::RenewStreamForAuth() { | 56 HttpStream* HttpBasicStream::RenewStreamForAuth() { |
60 DCHECK(IsResponseBodyComplete()); | 57 DCHECK(IsResponseBodyComplete()); |
61 DCHECK(!parser()->IsMoreDataBuffered()); | 58 DCHECK(!parser()->IsMoreDataBuffered()); |
62 // The HttpStreamParser object still has a pointer to the connection. Just to | 59 // The HttpStreamParser object still has a pointer to the connection. Just to |
63 // be extra-sure it doesn't touch the connection again, delete it here rather | 60 // be extra-sure it doesn't touch the connection again, delete it here rather |
64 // than leaving it until the destructor is called. | 61 // than leaving it until the destructor is called. |
65 state_.DeleteParser(); | 62 state_.DeleteParser(); |
66 return new HttpBasicStream(state_.ReleaseConnection(), state_.using_proxy(), | 63 return new HttpBasicStream(state_.ReleaseConnection(), state_.using_proxy()); |
67 state_.http_09_on_non_default_ports_enabled()); | |
68 } | 64 } |
69 | 65 |
70 bool HttpBasicStream::IsResponseBodyComplete() const { | 66 bool HttpBasicStream::IsResponseBodyComplete() const { |
71 return parser()->IsResponseBodyComplete(); | 67 return parser()->IsResponseBodyComplete(); |
72 } | 68 } |
73 | 69 |
74 bool HttpBasicStream::IsConnectionReused() const { | 70 bool HttpBasicStream::IsConnectionReused() const { |
75 return parser()->IsConnectionReused(); | 71 return parser()->IsConnectionReused(); |
76 } | 72 } |
77 | 73 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // like the right version should be reported, if headers were received. | 127 // like the right version should be reported, if headers were received. |
132 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1; | 128 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1; |
133 return; | 129 return; |
134 } | 130 } |
135 | 131 |
136 void HttpBasicStream::SetPriority(RequestPriority priority) { | 132 void HttpBasicStream::SetPriority(RequestPriority priority) { |
137 // TODO(akalin): Plumb this through to |connection_|. | 133 // TODO(akalin): Plumb this through to |connection_|. |
138 } | 134 } |
139 | 135 |
140 } // namespace net | 136 } // namespace net |
OLD | NEW |