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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 return rv; | 253 return rv; |
254 } | 254 } |
255 | 255 |
256 void HttpNetworkTransaction::PrepareForAuthRestart(HttpAuth::Target target) { | 256 void HttpNetworkTransaction::PrepareForAuthRestart(HttpAuth::Target target) { |
257 DCHECK(HaveAuth(target)); | 257 DCHECK(HaveAuth(target)); |
258 DCHECK(!stream_request_.get()); | 258 DCHECK(!stream_request_.get()); |
259 | 259 |
260 bool keep_alive = false; | 260 bool keep_alive = false; |
261 // Even if the server says the connection is keep-alive, we have to be | 261 // Even if the server says the connection is keep-alive, we have to be |
262 // able to find the end of each response in order to reuse the connection. | 262 // able to find the end of each response in order to reuse the connection. |
263 if (GetResponseHeaders()->IsKeepAlive() && | 263 HttpResponseHeaders* headers = GetResponseHeaders(); |
264 if (headers && headers->IsKeepAlive() && | |
Ryan Hamilton
2012/08/03 19:52:14
Is this change related to the SPDY server push bug
ramant (doing other things)
2012/08/03 20:50:40
Deleted this change.
| |
264 stream_->CanFindEndOfResponse()) { | 265 stream_->CanFindEndOfResponse()) { |
265 // If the response body hasn't been completely read, we need to drain | 266 // If the response body hasn't been completely read, we need to drain |
266 // it first. | 267 // it first. |
267 if (!stream_->IsResponseBodyComplete()) { | 268 if (!stream_->IsResponseBodyComplete()) { |
268 next_state_ = STATE_DRAIN_BODY_FOR_AUTH_RESTART; | 269 next_state_ = STATE_DRAIN_BODY_FOR_AUTH_RESTART; |
269 read_buf_ = new IOBuffer(kDrainBodyBufferSize); // A bit bucket. | 270 read_buf_ = new IOBuffer(kDrainBodyBufferSize); // A bit bucket. |
270 read_buf_len_ = kDrainBodyBufferSize; | 271 read_buf_len_ = kDrainBodyBufferSize; |
271 return; | 272 return; |
272 } | 273 } |
273 keep_alive = true; | 274 keep_alive = true; |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
913 | 914 |
914 bool keep_alive = false; | 915 bool keep_alive = false; |
915 if (stream_->IsResponseBodyComplete()) { | 916 if (stream_->IsResponseBodyComplete()) { |
916 // Note: Just because IsResponseBodyComplete is true, we're not | 917 // Note: Just because IsResponseBodyComplete is true, we're not |
917 // necessarily "done". We're only "done" when it is the last | 918 // necessarily "done". We're only "done" when it is the last |
918 // read on this HttpNetworkTransaction, which will be signified | 919 // read on this HttpNetworkTransaction, which will be signified |
919 // by a zero-length read. | 920 // by a zero-length read. |
920 // TODO(mbelshe): The keepalive property is really a property of | 921 // TODO(mbelshe): The keepalive property is really a property of |
921 // the stream. No need to compute it here just to pass back | 922 // the stream. No need to compute it here just to pass back |
922 // to the stream's Close function. | 923 // to the stream's Close function. |
923 if (stream_->CanFindEndOfResponse()) | 924 if (stream_->CanFindEndOfResponse()) { |
924 keep_alive = GetResponseHeaders()->IsKeepAlive(); | 925 HttpResponseHeaders* headers = GetResponseHeaders(); |
Ryan Hamilton
2012/08/03 19:52:14
(Ditto)
ramant (doing other things)
2012/08/03 20:50:40
SpdyNetworkTransactionSpdy3Test..ServerPushWithNoS
Ryan Hamilton
2012/08/03 21:10:01
Does that test cause a crash with your new code, o
| |
926 if (headers) | |
927 keep_alive = headers->IsKeepAlive(); | |
928 } | |
925 } | 929 } |
926 | 930 |
927 // Clean up connection if we are done. | 931 // Clean up connection if we are done. |
928 if (done) { | 932 if (done) { |
929 LogTransactionMetrics(); | 933 LogTransactionMetrics(); |
930 stream_->LogNumRttVsBytesMetrics(); | 934 stream_->LogNumRttVsBytesMetrics(); |
931 stream_->Close(!keep_alive); | 935 stream_->Close(!keep_alive); |
932 // Note: we don't reset the stream here. We've closed it, but we still | 936 // Note: we don't reset the stream here. We've closed it, but we still |
933 // need it around so that callers can call methods such as | 937 // need it around so that callers can call methods such as |
934 // GetUploadProgress() and have them be meaningful. | 938 // GetUploadProgress() and have them be meaningful. |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1409 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1413 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1410 state); | 1414 state); |
1411 break; | 1415 break; |
1412 } | 1416 } |
1413 return description; | 1417 return description; |
1414 } | 1418 } |
1415 | 1419 |
1416 #undef STATE_CASE | 1420 #undef STATE_CASE |
1417 | 1421 |
1418 } // namespace net | 1422 } // namespace net |
OLD | NEW |