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 if (stream_->CanFindEndOfResponse()) { |
924 keep_alive = GetResponseHeaders()->IsKeepAlive(); | 924 HttpResponseHeaders* headers = GetResponseHeaders(); |
| 925 if (headers) |
| 926 keep_alive = headers->IsKeepAlive(); |
| 927 } |
925 } | 928 } |
926 | 929 |
927 // Clean up connection if we are done. | 930 // Clean up connection if we are done. |
928 if (done) { | 931 if (done) { |
929 LogTransactionMetrics(); | 932 LogTransactionMetrics(); |
930 stream_->LogNumRttVsBytesMetrics(); | 933 stream_->LogNumRttVsBytesMetrics(); |
931 stream_->Close(!keep_alive); | 934 stream_->Close(!keep_alive); |
932 // Note: we don't reset the stream here. We've closed it, but we still | 935 // 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 | 936 // need it around so that callers can call methods such as |
934 // GetUploadProgress() and have them be meaningful. | 937 // 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, | 1412 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1410 state); | 1413 state); |
1411 break; | 1414 break; |
1412 } | 1415 } |
1413 return description; | 1416 return description; |
1414 } | 1417 } |
1415 | 1418 |
1416 #undef STATE_CASE | 1419 #undef STATE_CASE |
1417 | 1420 |
1418 } // namespace net | 1421 } // namespace net |
OLD | NEW |