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_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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (connection_info != CONNECTION_INFO_UNKNOWN) | 382 if (connection_info != CONNECTION_INFO_UNKNOWN) |
383 pickle->WriteInt(static_cast<int>(connection_info)); | 383 pickle->WriteInt(static_cast<int>(connection_info)); |
384 | 384 |
385 if (ssl_info.is_valid() && ssl_info.key_exchange_info != 0) | 385 if (ssl_info.is_valid() && ssl_info.key_exchange_info != 0) |
386 pickle->WriteInt(ssl_info.key_exchange_info); | 386 pickle->WriteInt(ssl_info.key_exchange_info); |
387 } | 387 } |
388 | 388 |
389 HttpResponseInfo::ConnectionInfo HttpResponseInfo::ConnectionInfoFromNextProto( | 389 HttpResponseInfo::ConnectionInfo HttpResponseInfo::ConnectionInfoFromNextProto( |
390 NextProto next_proto) { | 390 NextProto next_proto) { |
391 switch (next_proto) { | 391 switch (next_proto) { |
392 case kProtoDeprecatedSPDY2: | |
393 return CONNECTION_INFO_DEPRECATED_SPDY2; | |
394 case kProtoSPDY3: | 392 case kProtoSPDY3: |
395 case kProtoSPDY31: | 393 case kProtoSPDY31: |
396 return CONNECTION_INFO_SPDY3; | 394 return CONNECTION_INFO_SPDY3; |
397 case kProtoHTTP2: | 395 case kProtoHTTP2: |
398 return CONNECTION_INFO_HTTP2; | 396 return CONNECTION_INFO_HTTP2; |
399 case kProtoQUIC1SPDY3: | 397 case kProtoQUIC1SPDY3: |
400 return CONNECTION_INFO_QUIC1_SPDY3; | 398 return CONNECTION_INFO_QUIC1_SPDY3; |
401 | 399 |
402 case kProtoUnknown: | 400 case kProtoUnknown: |
403 case kProtoHTTP11: | 401 case kProtoHTTP11: |
404 break; | 402 break; |
405 } | 403 } |
406 | 404 |
407 NOTREACHED(); | 405 NOTREACHED(); |
408 return CONNECTION_INFO_UNKNOWN; | 406 return CONNECTION_INFO_UNKNOWN; |
409 } | 407 } |
410 | 408 |
411 // static | 409 // static |
412 std::string HttpResponseInfo::ConnectionInfoToString( | 410 std::string HttpResponseInfo::ConnectionInfoToString( |
413 ConnectionInfo connection_info) { | 411 ConnectionInfo connection_info) { |
414 switch (connection_info) { | 412 switch (connection_info) { |
415 case CONNECTION_INFO_UNKNOWN: | 413 case CONNECTION_INFO_UNKNOWN: |
416 return "unknown"; | 414 return "unknown"; |
417 case CONNECTION_INFO_HTTP1: | 415 case CONNECTION_INFO_HTTP1: |
418 return "http/1"; | 416 return "http/1"; |
419 case CONNECTION_INFO_DEPRECATED_SPDY2: | 417 case CONNECTION_INFO_DEPRECATED_SPDY2: |
420 return "spdy/2"; | 418 NOTREACHED(); |
| 419 return ""; |
421 case CONNECTION_INFO_SPDY3: | 420 case CONNECTION_INFO_SPDY3: |
422 return "spdy/3"; | 421 return "spdy/3"; |
423 // Since ConnectionInfo is persisted to disk, deprecated values have to be | 422 // Since ConnectionInfo is persisted to disk, deprecated values have to be |
424 // handled. Note that h2-14 and h2-15 are essentially wire compatible with | 423 // handled. Note that h2-14 and h2-15 are essentially wire compatible with |
425 // h2. | 424 // h2. |
426 // Intentional fallthrough. | 425 // Intentional fallthrough. |
427 case CONNECTION_INFO_HTTP2_14: | 426 case CONNECTION_INFO_HTTP2_14: |
428 case CONNECTION_INFO_HTTP2_15: | 427 case CONNECTION_INFO_HTTP2_15: |
429 case CONNECTION_INFO_HTTP2: | 428 case CONNECTION_INFO_HTTP2: |
430 return "h2"; | 429 return "h2"; |
431 case CONNECTION_INFO_QUIC1_SPDY3: | 430 case CONNECTION_INFO_QUIC1_SPDY3: |
432 return "quic/1+spdy/3"; | 431 return "quic/1+spdy/3"; |
433 case NUM_OF_CONNECTION_INFOS: | 432 case NUM_OF_CONNECTION_INFOS: |
434 break; | 433 break; |
435 } | 434 } |
436 NOTREACHED(); | 435 NOTREACHED(); |
437 return ""; | 436 return ""; |
438 } | 437 } |
439 | 438 |
440 } // namespace net | 439 } // namespace net |
OLD | NEW |