OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_pipelined_stream.h" | 5 #include "net/http/http_pipelined_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/http/http_pipelined_connection_impl.h" | 10 #include "net/http/http_pipelined_connection_impl.h" |
11 #include "net/http/http_request_headers.h" | 11 #include "net/http/http_request_headers.h" |
12 #include "net/http/http_request_info.h" | 12 #include "net/http/http_request_info.h" |
13 #include "net/http/http_response_body_drainer.h" | |
14 #include "net/http/http_response_headers.h" | |
15 #include "net/http/http_response_info.h" | |
13 #include "net/http/http_util.h" | 16 #include "net/http/http_util.h" |
14 | 17 |
15 namespace net { | 18 namespace net { |
16 | 19 |
17 HttpPipelinedStream::HttpPipelinedStream(HttpPipelinedConnectionImpl* pipeline, | 20 HttpPipelinedStream::HttpPipelinedStream(HttpPipelinedConnectionImpl* pipeline, |
18 int pipeline_id) | 21 int pipeline_id) |
19 : pipeline_(pipeline), | 22 : pipeline_(pipeline), |
20 pipeline_id_(pipeline_id), | 23 pipeline_id_(pipeline_id), |
21 request_info_(NULL) { | 24 request_info_(NULL) { |
22 } | 25 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 } | 114 } |
112 | 115 |
113 bool HttpPipelinedStream::IsSpdyHttpStream() const { | 116 bool HttpPipelinedStream::IsSpdyHttpStream() const { |
114 return false; | 117 return false; |
115 } | 118 } |
116 | 119 |
117 void HttpPipelinedStream::LogNumRttVsBytesMetrics() const { | 120 void HttpPipelinedStream::LogNumRttVsBytesMetrics() const { |
118 // TODO(simonjam): I don't want to copy & paste this from http_basic_stream. | 121 // TODO(simonjam): I don't want to copy & paste this from http_basic_stream. |
119 } | 122 } |
120 | 123 |
121 void HttpPipelinedStream::Drain(HttpNetworkSession*) { | 124 void HttpPipelinedStream::Drain(HttpNetworkSession* session) { |
willchan no longer on Chromium
2011/11/20 18:09:21
I sort of suspect we want to defer the actual drai
James Simonsen
2011/11/22 01:24:20
Done.
| |
122 // On errors, we already evict everything from the pipeline and close it. | 125 if (!CanFindEndOfResponse()) { |
123 // TODO(simonjam): Consider trying to drain the pipeline in the same way that | 126 // TODO(simonjam): It may be faster to drain the entire pipeline and re-use |
124 // HttpBasicStream does. | 127 // the connection than to close it and start over. |
mmenke
2011/11/18 15:45:38
nit: Think we don't need this TODO any more, unle
James Simonsen
2011/11/22 01:24:20
I want to be able to recover without calling Close
| |
125 delete this; | 128 Close(true); |
129 delete this; | |
130 return; | |
131 } | |
132 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this); | |
133 drainer->StartWithSize(session, | |
134 GetResponseInfo()->headers->GetContentLength()); | |
mmenke
2011/11/18 15:45:38
Important: This doesn't work with chunked encodin
James Simonsen
2011/11/22 01:24:20
Thanks. Didn't know anything about chunked encodin
| |
135 // |drainer| will delete itself when done. | |
126 } | 136 } |
127 | 137 |
128 const SSLConfig& HttpPipelinedStream::used_ssl_config() const { | 138 const SSLConfig& HttpPipelinedStream::used_ssl_config() const { |
129 return pipeline_->used_ssl_config(); | 139 return pipeline_->used_ssl_config(); |
130 } | 140 } |
131 | 141 |
132 const ProxyInfo& HttpPipelinedStream::used_proxy_info() const { | 142 const ProxyInfo& HttpPipelinedStream::used_proxy_info() const { |
133 return pipeline_->used_proxy_info(); | 143 return pipeline_->used_proxy_info(); |
134 } | 144 } |
135 | 145 |
136 const NetLog::Source& HttpPipelinedStream::source() const { | 146 const NetLog::Source& HttpPipelinedStream::source() const { |
137 return pipeline_->source(); | 147 return pipeline_->source(); |
138 } | 148 } |
139 | 149 |
140 bool HttpPipelinedStream::was_npn_negotiated() const { | 150 bool HttpPipelinedStream::was_npn_negotiated() const { |
141 return pipeline_->was_npn_negotiated(); | 151 return pipeline_->was_npn_negotiated(); |
142 } | 152 } |
143 | 153 |
144 } // namespace net | 154 } // namespace net |
OLD | NEW |