Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: net/http/http_response_info.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_response_info.h" 5 #include "net/http/http_response_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "net/base/auth.h" 10 #include "net/base/auth.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (!iter.ReadInt(&flags)) 172 if (!iter.ReadInt(&flags))
173 return false; 173 return false;
174 int version = flags & RESPONSE_INFO_VERSION_MASK; 174 int version = flags & RESPONSE_INFO_VERSION_MASK;
175 if (version < RESPONSE_INFO_MINIMUM_VERSION || 175 if (version < RESPONSE_INFO_MINIMUM_VERSION ||
176 version > RESPONSE_INFO_VERSION) { 176 version > RESPONSE_INFO_VERSION) {
177 DLOG(ERROR) << "unexpected response info version: " << version; 177 DLOG(ERROR) << "unexpected response info version: " << version;
178 return false; 178 return false;
179 } 179 }
180 180
181 // Read request-time 181 // Read request-time
182 int64 time_val; 182 int64_t time_val;
183 if (!iter.ReadInt64(&time_val)) 183 if (!iter.ReadInt64(&time_val))
184 return false; 184 return false;
185 request_time = Time::FromInternalValue(time_val); 185 request_time = Time::FromInternalValue(time_val);
186 was_cached = true; // Set status to show cache resurrection. 186 was_cached = true; // Set status to show cache resurrection.
187 187
188 // Read response-time 188 // Read response-time
189 if (!iter.ReadInt64(&time_val)) 189 if (!iter.ReadInt64(&time_val))
190 return false; 190 return false;
191 response_time = Time::FromInternalValue(time_val); 191 response_time = Time::FromInternalValue(time_val);
192 192
(...skipping 29 matching lines...) Expand all
222 ssl_info.connection_status = connection_status; 222 ssl_info.connection_status = connection_status;
223 } 223 }
224 224
225 if (flags & RESPONSE_INFO_HAS_SIGNED_CERTIFICATE_TIMESTAMPS) { 225 if (flags & RESPONSE_INFO_HAS_SIGNED_CERTIFICATE_TIMESTAMPS) {
226 int num_scts; 226 int num_scts;
227 if (!iter.ReadInt(&num_scts)) 227 if (!iter.ReadInt(&num_scts))
228 return false; 228 return false;
229 for (int i = 0; i < num_scts; ++i) { 229 for (int i = 0; i < num_scts; ++i) {
230 scoped_refptr<ct::SignedCertificateTimestamp> sct( 230 scoped_refptr<ct::SignedCertificateTimestamp> sct(
231 ct::SignedCertificateTimestamp::CreateFromPickle(&iter)); 231 ct::SignedCertificateTimestamp::CreateFromPickle(&iter));
232 uint16 status; 232 uint16_t status;
233 if (!sct.get() || !iter.ReadUInt16(&status)) 233 if (!sct.get() || !iter.ReadUInt16(&status))
234 return false; 234 return false;
235 ssl_info.signed_certificate_timestamps.push_back( 235 ssl_info.signed_certificate_timestamps.push_back(
236 SignedCertificateTimestampAndStatus( 236 SignedCertificateTimestampAndStatus(
237 sct, static_cast<ct::SCTVerifyStatus>(status))); 237 sct, static_cast<ct::SCTVerifyStatus>(status)));
238 } 238 }
239 } 239 }
240 240
241 // Read vary-data 241 // Read vary-data
242 if (flags & RESPONSE_INFO_HAS_VARY_DATA) { 242 if (flags & RESPONSE_INFO_HAS_VARY_DATA) {
243 if (!vary_data.InitFromPickle(&iter)) 243 if (!vary_data.InitFromPickle(&iter))
244 return false; 244 return false;
245 } 245 }
246 246
247 // Read socket_address. 247 // Read socket_address.
248 std::string socket_address_host; 248 std::string socket_address_host;
249 if (iter.ReadString(&socket_address_host)) { 249 if (iter.ReadString(&socket_address_host)) {
250 // If the host was written, we always expect the port to follow. 250 // If the host was written, we always expect the port to follow.
251 uint16 socket_address_port; 251 uint16_t socket_address_port;
252 if (!iter.ReadUInt16(&socket_address_port)) 252 if (!iter.ReadUInt16(&socket_address_port))
253 return false; 253 return false;
254 socket_address = HostPortPair(socket_address_host, socket_address_port); 254 socket_address = HostPortPair(socket_address_host, socket_address_port);
255 } else if (version > 1) { 255 } else if (version > 1) {
256 // socket_address was not always present in version 1 of the response 256 // socket_address was not always present in version 1 of the response
257 // info, so we don't fail if it can't be read. 257 // info, so we don't fail if it can't be read.
258 return false; 258 return false;
259 } 259 }
260 260
261 // Read protocol-version. 261 // Read protocol-version.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 if (ssl_info.security_bits != -1) 358 if (ssl_info.security_bits != -1)
359 pickle->WriteInt(ssl_info.security_bits); 359 pickle->WriteInt(ssl_info.security_bits);
360 if (ssl_info.connection_status != 0) 360 if (ssl_info.connection_status != 0)
361 pickle->WriteInt(ssl_info.connection_status); 361 pickle->WriteInt(ssl_info.connection_status);
362 if (!ssl_info.signed_certificate_timestamps.empty()) { 362 if (!ssl_info.signed_certificate_timestamps.empty()) {
363 pickle->WriteInt(ssl_info.signed_certificate_timestamps.size()); 363 pickle->WriteInt(ssl_info.signed_certificate_timestamps.size());
364 for (SignedCertificateTimestampAndStatusList::const_iterator it = 364 for (SignedCertificateTimestampAndStatusList::const_iterator it =
365 ssl_info.signed_certificate_timestamps.begin(); it != 365 ssl_info.signed_certificate_timestamps.begin(); it !=
366 ssl_info.signed_certificate_timestamps.end(); ++it) { 366 ssl_info.signed_certificate_timestamps.end(); ++it) {
367 it->sct->Persist(pickle); 367 it->sct->Persist(pickle);
368 pickle->WriteUInt16(static_cast<uint16>(it->status)); 368 pickle->WriteUInt16(static_cast<uint16_t>(it->status));
369 } 369 }
370 } 370 }
371 } 371 }
372 372
373 if (vary_data.is_valid()) 373 if (vary_data.is_valid())
374 vary_data.Persist(pickle); 374 vary_data.Persist(pickle);
375 375
376 pickle->WriteString(socket_address.host()); 376 pickle->WriteString(socket_address.host());
377 pickle->WriteUInt16(socket_address.port()); 377 pickle->WriteUInt16(socket_address.port());
378 378
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 case CONNECTION_INFO_QUIC1_SPDY3: 431 case CONNECTION_INFO_QUIC1_SPDY3:
432 return "quic/1+spdy/3"; 432 return "quic/1+spdy/3";
433 case NUM_OF_CONNECTION_INFOS: 433 case NUM_OF_CONNECTION_INFOS:
434 break; 434 break;
435 } 435 }
436 NOTREACHED(); 436 NOTREACHED();
437 return ""; 437 return "";
438 } 438 }
439 439
440 } // namespace net 440 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698