| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 | 1027 |
| 1028 // read response-time | 1028 // read response-time |
| 1029 if (!pickle.ReadInt64(&iter, &time_val)) | 1029 if (!pickle.ReadInt64(&iter, &time_val)) |
| 1030 return false; | 1030 return false; |
| 1031 response_info->response_time = Time::FromInternalValue(time_val); | 1031 response_info->response_time = Time::FromInternalValue(time_val); |
| 1032 | 1032 |
| 1033 // read response-headers | 1033 // read response-headers |
| 1034 response_info->headers = new HttpResponseHeaders(pickle, &iter); | 1034 response_info->headers = new HttpResponseHeaders(pickle, &iter); |
| 1035 DCHECK(response_info->headers->response_code() != -1); | 1035 DCHECK(response_info->headers->response_code() != -1); |
| 1036 | 1036 |
| 1037 #if defined(OS_WIN) |
| 1037 // read ssl-info | 1038 // read ssl-info |
| 1038 if (flags & RESPONSE_INFO_HAS_CERT) { | 1039 if (flags & RESPONSE_INFO_HAS_CERT) { |
| 1039 response_info->ssl_info.cert = | 1040 response_info->ssl_info.cert = |
| 1040 X509Certificate::CreateFromPickle(pickle, &iter); | 1041 X509Certificate::CreateFromPickle(pickle, &iter); |
| 1041 } | 1042 } |
| 1042 if (flags & RESPONSE_INFO_HAS_CERT_STATUS) { | 1043 if (flags & RESPONSE_INFO_HAS_CERT_STATUS) { |
| 1043 int cert_status; | 1044 int cert_status; |
| 1044 if (!pickle.ReadInt(&iter, &cert_status)) | 1045 if (!pickle.ReadInt(&iter, &cert_status)) |
| 1045 return false; | 1046 return false; |
| 1046 response_info->ssl_info.cert_status = cert_status; | 1047 response_info->ssl_info.cert_status = cert_status; |
| 1047 } | 1048 } |
| 1048 if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) { | 1049 if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) { |
| 1049 int security_bits; | 1050 int security_bits; |
| 1050 if (!pickle.ReadInt(&iter, &security_bits)) | 1051 if (!pickle.ReadInt(&iter, &security_bits)) |
| 1051 return false; | 1052 return false; |
| 1052 response_info->ssl_info.security_bits = security_bits; | 1053 response_info->ssl_info.security_bits = security_bits; |
| 1053 } | 1054 } |
| 1055 #else |
| 1056 // TODO(port): Just enable above when SSL stuff is ported. |
| 1057 NOTIMPLEMENTED(); |
| 1058 #endif |
| 1054 | 1059 |
| 1055 // read vary-data | 1060 // read vary-data |
| 1056 if (flags & RESPONSE_INFO_HAS_VARY_DATA) { | 1061 if (flags & RESPONSE_INFO_HAS_VARY_DATA) { |
| 1057 if (!response_info->vary_data.InitFromPickle(pickle, &iter)) | 1062 if (!response_info->vary_data.InitFromPickle(pickle, &iter)) |
| 1058 return false; | 1063 return false; |
| 1059 } | 1064 } |
| 1060 | 1065 |
| 1061 return true; | 1066 return true; |
| 1062 } | 1067 } |
| 1063 | 1068 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1075 if (response_info->vary_data.is_valid()) | 1080 if (response_info->vary_data.is_valid()) |
| 1076 flags |= RESPONSE_INFO_HAS_VARY_DATA; | 1081 flags |= RESPONSE_INFO_HAS_VARY_DATA; |
| 1077 | 1082 |
| 1078 Pickle pickle; | 1083 Pickle pickle; |
| 1079 pickle.WriteInt(flags); | 1084 pickle.WriteInt(flags); |
| 1080 pickle.WriteInt64(response_info->request_time.ToInternalValue()); | 1085 pickle.WriteInt64(response_info->request_time.ToInternalValue()); |
| 1081 pickle.WriteInt64(response_info->response_time.ToInternalValue()); | 1086 pickle.WriteInt64(response_info->response_time.ToInternalValue()); |
| 1082 | 1087 |
| 1083 response_info->headers->Persist(&pickle, skip_transient_headers); | 1088 response_info->headers->Persist(&pickle, skip_transient_headers); |
| 1084 | 1089 |
| 1090 #if defined(OS_WIN) |
| 1085 if (response_info->ssl_info.cert) { | 1091 if (response_info->ssl_info.cert) { |
| 1086 response_info->ssl_info.cert->Persist(&pickle); | 1092 response_info->ssl_info.cert->Persist(&pickle); |
| 1087 pickle.WriteInt(response_info->ssl_info.cert_status); | 1093 pickle.WriteInt(response_info->ssl_info.cert_status); |
| 1088 } | 1094 } |
| 1089 if (response_info->ssl_info.security_bits != -1) | 1095 if (response_info->ssl_info.security_bits != -1) |
| 1090 pickle.WriteInt(response_info->ssl_info.security_bits); | 1096 pickle.WriteInt(response_info->ssl_info.security_bits); |
| 1097 #else |
| 1098 // TODO(port): Just enable above when SSL stuff is ported. |
| 1099 NOTIMPLEMENTED(); |
| 1100 #endif |
| 1091 | 1101 |
| 1092 if (response_info->vary_data.is_valid()) | 1102 if (response_info->vary_data.is_valid()) |
| 1093 response_info->vary_data.Persist(&pickle); | 1103 response_info->vary_data.Persist(&pickle); |
| 1094 | 1104 |
| 1095 const char* data = static_cast<const char*>(pickle.data()); | 1105 const char* data = static_cast<const char*>(pickle.data()); |
| 1096 int len = static_cast<int>(pickle.size()); | 1106 int len = static_cast<int>(pickle.size()); |
| 1097 | 1107 |
| 1098 return disk_entry->WriteData(kResponseInfoIndex, 0, data, len, NULL, | 1108 return disk_entry->WriteData(kResponseInfoIndex, 0, data, len, NULL, |
| 1099 true) == len; | 1109 true) == len; |
| 1100 } | 1110 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 | 1337 |
| 1328 entry->pending_queue.erase(entry->pending_queue.begin()); | 1338 entry->pending_queue.erase(entry->pending_queue.begin()); |
| 1329 | 1339 |
| 1330 AddTransactionToEntry(entry, next); | 1340 AddTransactionToEntry(entry, next); |
| 1331 } | 1341 } |
| 1332 | 1342 |
| 1333 //----------------------------------------------------------------------------- | 1343 //----------------------------------------------------------------------------- |
| 1334 | 1344 |
| 1335 } // namespace net | 1345 } // namespace net |
| 1336 | 1346 |
| OLD | NEW |