| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 if (connection_info != CONNECTION_INFO_UNKNOWN) | 393 if (connection_info != CONNECTION_INFO_UNKNOWN) |
| 394 pickle->WriteInt(static_cast<int>(connection_info)); | 394 pickle->WriteInt(static_cast<int>(connection_info)); |
| 395 | 395 |
| 396 if (ssl_info.is_valid() && ssl_info.key_exchange_info != 0) | 396 if (ssl_info.is_valid() && ssl_info.key_exchange_info != 0) |
| 397 pickle->WriteInt(ssl_info.key_exchange_info); | 397 pickle->WriteInt(ssl_info.key_exchange_info); |
| 398 } | 398 } |
| 399 | 399 |
| 400 HttpResponseInfo::ConnectionInfo HttpResponseInfo::ConnectionInfoFromNextProto( | 400 HttpResponseInfo::ConnectionInfo HttpResponseInfo::ConnectionInfoFromNextProto( |
| 401 NextProto next_proto) { | 401 NextProto next_proto) { |
| 402 switch (next_proto) { | 402 switch (next_proto) { |
| 403 case kProtoSPDY31: | |
| 404 return CONNECTION_INFO_SPDY3; | |
| 405 case kProtoHTTP2: | 403 case kProtoHTTP2: |
| 406 return CONNECTION_INFO_HTTP2; | 404 return CONNECTION_INFO_HTTP2; |
| 407 case kProtoQUIC1SPDY3: | 405 case kProtoQUIC1SPDY3: |
| 408 return CONNECTION_INFO_QUIC1_SPDY3; | 406 return CONNECTION_INFO_QUIC1_SPDY3; |
| 409 | 407 |
| 410 case kProtoUnknown: | 408 case kProtoUnknown: |
| 411 case kProtoHTTP11: | 409 case kProtoHTTP11: |
| 412 break; | 410 break; |
| 413 } | 411 } |
| 414 | 412 |
| 415 NOTREACHED(); | 413 NOTREACHED(); |
| 416 return CONNECTION_INFO_UNKNOWN; | 414 return CONNECTION_INFO_UNKNOWN; |
| 417 } | 415 } |
| 418 | 416 |
| 419 // static | 417 // static |
| 420 std::string HttpResponseInfo::ConnectionInfoToString( | 418 std::string HttpResponseInfo::ConnectionInfoToString( |
| 421 ConnectionInfo connection_info) { | 419 ConnectionInfo connection_info) { |
| 422 switch (connection_info) { | 420 switch (connection_info) { |
| 423 case CONNECTION_INFO_UNKNOWN: | 421 case CONNECTION_INFO_UNKNOWN: |
| 424 return "unknown"; | 422 return "unknown"; |
| 425 case CONNECTION_INFO_HTTP1_1: | 423 case CONNECTION_INFO_HTTP1_1: |
| 426 return "http/1.1"; | 424 return "http/1.1"; |
| 427 case CONNECTION_INFO_DEPRECATED_SPDY2: | 425 case CONNECTION_INFO_DEPRECATED_SPDY2: |
| 428 NOTREACHED(); | 426 NOTREACHED(); |
| 429 return ""; | 427 return ""; |
| 430 case CONNECTION_INFO_SPDY3: | 428 case CONNECTION_INFO_DEPRECATED_SPDY3: |
| 431 return "spdy/3"; | 429 return "spdy/3"; |
| 432 // Since ConnectionInfo is persisted to disk, deprecated values have to be | 430 // Since ConnectionInfo is persisted to disk, deprecated values have to be |
| 433 // handled. Note that h2-14 and h2-15 are essentially wire compatible with | 431 // handled. Note that h2-14 and h2-15 are essentially wire compatible with |
| 434 // h2. | 432 // h2. |
| 435 // Intentional fallthrough. | 433 // Intentional fallthrough. |
| 436 case CONNECTION_INFO_HTTP2_14: | 434 case CONNECTION_INFO_DEPRECATED_HTTP2_14: |
| 437 case CONNECTION_INFO_HTTP2_15: | 435 case CONNECTION_INFO_DEPRECATED_HTTP2_15: |
| 438 case CONNECTION_INFO_HTTP2: | 436 case CONNECTION_INFO_HTTP2: |
| 439 return "h2"; | 437 return "h2"; |
| 440 case CONNECTION_INFO_QUIC1_SPDY3: | 438 case CONNECTION_INFO_QUIC1_SPDY3: |
| 441 return "quic/1+spdy/3"; | 439 return "quic/1+spdy/3"; |
| 442 case CONNECTION_INFO_HTTP0_9: | 440 case CONNECTION_INFO_HTTP0_9: |
| 443 return "http/0.9"; | 441 return "http/0.9"; |
| 444 case CONNECTION_INFO_HTTP1_0: | 442 case CONNECTION_INFO_HTTP1_0: |
| 445 return "http/1.0"; | 443 return "http/1.0"; |
| 446 case NUM_OF_CONNECTION_INFOS: | 444 case NUM_OF_CONNECTION_INFOS: |
| 447 break; | 445 break; |
| 448 } | 446 } |
| 449 NOTREACHED(); | 447 NOTREACHED(); |
| 450 return ""; | 448 return ""; |
| 451 } | 449 } |
| 452 | 450 |
| 453 } // namespace net | 451 } // namespace net |
| OLD | NEW |