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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 | 913 |
914 bool keep_alive = false; | 914 bool keep_alive = false; |
915 if (stream_->IsResponseBodyComplete()) { | 915 if (stream_->IsResponseBodyComplete()) { |
916 // Note: Just because IsResponseBodyComplete is true, we're not | 916 // Note: Just because IsResponseBodyComplete is true, we're not |
917 // necessarily "done". We're only "done" when it is the last | 917 // necessarily "done". We're only "done" when it is the last |
918 // read on this HttpNetworkTransaction, which will be signified | 918 // read on this HttpNetworkTransaction, which will be signified |
919 // by a zero-length read. | 919 // by a zero-length read. |
920 // TODO(mbelshe): The keepalive property is really a property of | 920 // TODO(mbelshe): The keepalive property is really a property of |
921 // the stream. No need to compute it here just to pass back | 921 // the stream. No need to compute it here just to pass back |
922 // to the stream's Close function. | 922 // to the stream's Close function. |
923 if (stream_->CanFindEndOfResponse()) | 923 // TODO(rtenneti): CanFindEndOfResponse should return false if there are no |
924 keep_alive = GetResponseHeaders()->IsKeepAlive(); | 924 // ResponseHeaders. |
| 925 if (stream_->CanFindEndOfResponse()) { |
| 926 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 927 if (headers) |
| 928 keep_alive = headers->IsKeepAlive(); |
| 929 } |
925 } | 930 } |
926 | 931 |
927 // Clean up connection if we are done. | 932 // Clean up connection if we are done. |
928 if (done) { | 933 if (done) { |
929 LogTransactionMetrics(); | 934 LogTransactionMetrics(); |
930 stream_->LogNumRttVsBytesMetrics(); | 935 stream_->LogNumRttVsBytesMetrics(); |
931 stream_->Close(!keep_alive); | 936 stream_->Close(!keep_alive); |
932 // Note: we don't reset the stream here. We've closed it, but we still | 937 // 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 | 938 // need it around so that callers can call methods such as |
934 // GetUploadProgress() and have them be meaningful. | 939 // 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, | 1414 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1410 state); | 1415 state); |
1411 break; | 1416 break; |
1412 } | 1417 } |
1413 return description; | 1418 return description; |
1414 } | 1419 } |
1415 | 1420 |
1416 #undef STATE_CASE | 1421 #undef STATE_CASE |
1417 | 1422 |
1418 } // namespace net | 1423 } // namespace net |
OLD | NEW |