| 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/spdy/spdy_protocol.h" | 5 #include "net/spdy/spdy_protocol.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( | 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( |
| 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} | 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 /* | 365 /* |
| 366 // This works because GOAWAY and RST_STREAM share a namespace. | 366 // This works because GOAWAY and RST_STREAM share a namespace. |
| 367 if (rst_stream_status_field == | 367 if (rst_stream_status_field == |
| 368 SerializeGoAwayStatus(version, GOAWAY_COMPRESSION_ERROR) || | 368 SerializeGoAwayStatus(version, GOAWAY_COMPRESSION_ERROR) || |
| 369 rst_stream_status_field == | 369 rst_stream_status_field == |
| 370 SerializeGoAwayStatus(version, GOAWAY_SETTINGS_TIMEOUT)) { | 370 SerializeGoAwayStatus(version, GOAWAY_SETTINGS_TIMEOUT)) { |
| 371 return false; | 371 return false; |
| 372 } | 372 } |
| 373 */ | 373 */ |
| 374 | 374 |
| 375 // ENHANCE_YOUR_CALM is the last valid status code. | 375 // HTTP_1_1_REQUIRED is the last valid status code. |
| 376 if (rst_stream_status_field > | 376 if (rst_stream_status_field > |
| 377 SerializeRstStreamStatus(version, RST_STREAM_ENHANCE_YOUR_CALM)) { | 377 SerializeRstStreamStatus(version, RST_STREAM_HTTP_1_1_REQUIRED)) { |
| 378 return false; | 378 return false; |
| 379 } | 379 } |
| 380 | 380 |
| 381 return true; | 381 return true; |
| 382 } | 382 } |
| 383 LOG(DFATAL) << "Unhandled SPDY version " << version; | 383 LOG(DFATAL) << "Unhandled SPDY version " << version; |
| 384 return false; | 384 return false; |
| 385 } | 385 } |
| 386 | 386 |
| 387 SpdyRstStreamStatus SpdyConstants::ParseRstStreamStatus( | 387 SpdyRstStreamStatus SpdyConstants::ParseRstStreamStatus( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 case 6: | 429 case 6: |
| 430 return RST_STREAM_FRAME_SIZE_ERROR; | 430 return RST_STREAM_FRAME_SIZE_ERROR; |
| 431 case 7: | 431 case 7: |
| 432 return RST_STREAM_REFUSED_STREAM; | 432 return RST_STREAM_REFUSED_STREAM; |
| 433 case 8: | 433 case 8: |
| 434 return RST_STREAM_CANCEL; | 434 return RST_STREAM_CANCEL; |
| 435 case 10: | 435 case 10: |
| 436 return RST_STREAM_CONNECT_ERROR; | 436 return RST_STREAM_CONNECT_ERROR; |
| 437 case 11: | 437 case 11: |
| 438 return RST_STREAM_ENHANCE_YOUR_CALM; | 438 return RST_STREAM_ENHANCE_YOUR_CALM; |
| 439 case 12: |
| 440 return RST_STREAM_INADEQUATE_SECURITY; |
| 441 case 13: |
| 442 return RST_STREAM_HTTP_1_1_REQUIRED; |
| 439 } | 443 } |
| 440 break; | 444 break; |
| 441 } | 445 } |
| 442 | 446 |
| 443 LOG(DFATAL) << "Invalid RST_STREAM status " << rst_stream_status_field; | 447 LOG(DFATAL) << "Invalid RST_STREAM status " << rst_stream_status_field; |
| 444 return RST_STREAM_PROTOCOL_ERROR; | 448 return RST_STREAM_PROTOCOL_ERROR; |
| 445 } | 449 } |
| 446 | 450 |
| 447 int SpdyConstants::SerializeRstStreamStatus( | 451 int SpdyConstants::SerializeRstStreamStatus( |
| 448 SpdyMajorVersion version, | 452 SpdyMajorVersion version, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 case RST_STREAM_FRAME_SIZE_ERROR: | 496 case RST_STREAM_FRAME_SIZE_ERROR: |
| 493 return 6; | 497 return 6; |
| 494 case RST_STREAM_REFUSED_STREAM: | 498 case RST_STREAM_REFUSED_STREAM: |
| 495 return 7; | 499 return 7; |
| 496 case RST_STREAM_CANCEL: | 500 case RST_STREAM_CANCEL: |
| 497 return 8; | 501 return 8; |
| 498 case RST_STREAM_CONNECT_ERROR: | 502 case RST_STREAM_CONNECT_ERROR: |
| 499 return 10; | 503 return 10; |
| 500 case RST_STREAM_ENHANCE_YOUR_CALM: | 504 case RST_STREAM_ENHANCE_YOUR_CALM: |
| 501 return 11; | 505 return 11; |
| 506 case RST_STREAM_INADEQUATE_SECURITY: |
| 507 return 12; |
| 508 case RST_STREAM_HTTP_1_1_REQUIRED: |
| 509 return 13; |
| 502 default: | 510 default: |
| 503 LOG(DFATAL) << "Unhandled RST_STREAM status " | 511 LOG(DFATAL) << "Unhandled RST_STREAM status " |
| 504 << rst_stream_status; | 512 << rst_stream_status; |
| 505 return -1; | 513 return -1; |
| 506 } | 514 } |
| 507 } | 515 } |
| 508 LOG(DFATAL) << "Unhandled SPDY version " << version; | 516 LOG(DFATAL) << "Unhandled SPDY version " << version; |
| 509 return -1; | 517 return -1; |
| 510 } | 518 } |
| 511 | 519 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 case 8: | 590 case 8: |
| 583 return GOAWAY_CANCEL; | 591 return GOAWAY_CANCEL; |
| 584 case 9: | 592 case 9: |
| 585 return GOAWAY_COMPRESSION_ERROR; | 593 return GOAWAY_COMPRESSION_ERROR; |
| 586 case 10: | 594 case 10: |
| 587 return GOAWAY_CONNECT_ERROR; | 595 return GOAWAY_CONNECT_ERROR; |
| 588 case 11: | 596 case 11: |
| 589 return GOAWAY_ENHANCE_YOUR_CALM; | 597 return GOAWAY_ENHANCE_YOUR_CALM; |
| 590 case 12: | 598 case 12: |
| 591 return GOAWAY_INADEQUATE_SECURITY; | 599 return GOAWAY_INADEQUATE_SECURITY; |
| 600 case 13: |
| 601 return GOAWAY_HTTP_1_1_REQUIRED; |
| 592 } | 602 } |
| 593 break; | 603 break; |
| 594 } | 604 } |
| 595 | 605 |
| 596 LOG(DFATAL) << "Unhandled GOAWAY status " << goaway_status_field; | 606 LOG(DFATAL) << "Unhandled GOAWAY status " << goaway_status_field; |
| 597 return GOAWAY_PROTOCOL_ERROR; | 607 return GOAWAY_PROTOCOL_ERROR; |
| 598 } | 608 } |
| 599 | 609 |
| 600 SpdyMajorVersion SpdyConstants::ParseMajorVersion(int version_number) { | 610 SpdyMajorVersion SpdyConstants::ParseMajorVersion(int version_number) { |
| 601 switch (version_number) { | 611 switch (version_number) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 case GOAWAY_FLOW_CONTROL_ERROR: | 669 case GOAWAY_FLOW_CONTROL_ERROR: |
| 660 case GOAWAY_SETTINGS_TIMEOUT: | 670 case GOAWAY_SETTINGS_TIMEOUT: |
| 661 case GOAWAY_STREAM_CLOSED: | 671 case GOAWAY_STREAM_CLOSED: |
| 662 case GOAWAY_FRAME_SIZE_ERROR: | 672 case GOAWAY_FRAME_SIZE_ERROR: |
| 663 case GOAWAY_REFUSED_STREAM: | 673 case GOAWAY_REFUSED_STREAM: |
| 664 case GOAWAY_CANCEL: | 674 case GOAWAY_CANCEL: |
| 665 case GOAWAY_COMPRESSION_ERROR: | 675 case GOAWAY_COMPRESSION_ERROR: |
| 666 case GOAWAY_CONNECT_ERROR: | 676 case GOAWAY_CONNECT_ERROR: |
| 667 case GOAWAY_ENHANCE_YOUR_CALM: | 677 case GOAWAY_ENHANCE_YOUR_CALM: |
| 668 case GOAWAY_INADEQUATE_SECURITY: | 678 case GOAWAY_INADEQUATE_SECURITY: |
| 679 case GOAWAY_HTTP_1_1_REQUIRED: |
| 669 return 1; // PROTOCOL_ERROR. | 680 return 1; // PROTOCOL_ERROR. |
| 670 default: | 681 default: |
| 671 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; | 682 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; |
| 672 return -1; | 683 return -1; |
| 673 } | 684 } |
| 674 case SPDY4: | 685 case SPDY4: |
| 675 case SPDY5: | 686 case SPDY5: |
| 676 switch (status) { | 687 switch (status) { |
| 677 case GOAWAY_NO_ERROR: | 688 case GOAWAY_NO_ERROR: |
| 678 return 0; | 689 return 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 693 case GOAWAY_CANCEL: | 704 case GOAWAY_CANCEL: |
| 694 return 8; | 705 return 8; |
| 695 case GOAWAY_COMPRESSION_ERROR: | 706 case GOAWAY_COMPRESSION_ERROR: |
| 696 return 9; | 707 return 9; |
| 697 case GOAWAY_CONNECT_ERROR: | 708 case GOAWAY_CONNECT_ERROR: |
| 698 return 10; | 709 return 10; |
| 699 case GOAWAY_ENHANCE_YOUR_CALM: | 710 case GOAWAY_ENHANCE_YOUR_CALM: |
| 700 return 11; | 711 return 11; |
| 701 case GOAWAY_INADEQUATE_SECURITY: | 712 case GOAWAY_INADEQUATE_SECURITY: |
| 702 return 12; | 713 return 12; |
| 714 case GOAWAY_HTTP_1_1_REQUIRED: |
| 715 return 13; |
| 703 default: | 716 default: |
| 704 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; | 717 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; |
| 705 return -1; | 718 return -1; |
| 706 } | 719 } |
| 707 } | 720 } |
| 708 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version; | 721 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version; |
| 709 return -1; | 722 return -1; |
| 710 } | 723 } |
| 711 | 724 |
| 712 size_t SpdyConstants::GetDataFrameMinimumSize(SpdyMajorVersion version) { | 725 size_t SpdyConstants::GetDataFrameMinimumSize(SpdyMajorVersion version) { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 parent_stream_id_(parent_stream_id), | 877 parent_stream_id_(parent_stream_id), |
| 865 weight_(weight), | 878 weight_(weight), |
| 866 exclusive_(exclusive) { | 879 exclusive_(exclusive) { |
| 867 } | 880 } |
| 868 | 881 |
| 869 void SpdyPriorityIR::Visit(SpdyFrameVisitor* visitor) const { | 882 void SpdyPriorityIR::Visit(SpdyFrameVisitor* visitor) const { |
| 870 return visitor->VisitPriority(*this); | 883 return visitor->VisitPriority(*this); |
| 871 } | 884 } |
| 872 | 885 |
| 873 } // namespace net | 886 } // namespace net |
| OLD | NEW |