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 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't | 5 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't |
6 // constantly adding and subtracting header sizes; this is ugly and error- | 6 // constantly adding and subtracting header sizes; this is ugly and error- |
7 // prone. | 7 // prone. |
8 | 8 |
9 #include "net/spdy/spdy_framer.h" | 9 #include "net/spdy/spdy_framer.h" |
10 | 10 |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 DLOG(WARNING) << "Invalid length for SETTINGS frame: " | 727 DLOG(WARNING) << "Invalid length for SETTINGS frame: " |
728 << current_frame_length_; | 728 << current_frame_length_; |
729 set_error(SPDY_INVALID_CONTROL_FRAME); | 729 set_error(SPDY_INVALID_CONTROL_FRAME); |
730 } else if (current_frame_flags_ & | 730 } else if (current_frame_flags_ & |
731 ~SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS) { | 731 ~SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS) { |
732 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 732 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
733 } | 733 } |
734 break; | 734 break; |
735 case PING: | 735 case PING: |
736 if (current_frame_length_ != GetPingSize()) { | 736 if (current_frame_length_ != GetPingSize()) { |
737 set_error(SPDY_INVALID_CONTROL_FRAME); | 737 // TODO(akalin): Unignore this. |
| 738 // set_error(SPDY_INVALID_CONTROL_FRAME); |
738 } else if (spdy_version_ < SPDY4 && current_frame_flags_ != 0) { | 739 } else if (spdy_version_ < SPDY4 && current_frame_flags_ != 0) { |
739 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 740 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
740 } else if (spdy_version_ >= SPDY4 && (current_frame_flags_ & ~0x1) != 0) { | 741 } else if (spdy_version_ >= SPDY4 && (current_frame_flags_ & ~0x1) != 0) { |
741 // TODO(akalin): Unignore this. | 742 // TODO(akalin): Unignore this. |
742 // set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 743 // set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
743 } | 744 } |
744 break; | 745 break; |
745 case GOAWAY: | 746 case GOAWAY: |
746 { | 747 { |
747 if (current_frame_length_ != GetGoAwaySize()) { | 748 if (current_frame_length_ != GetGoAwaySize()) { |
(...skipping 18 matching lines...) Expand all Loading... |
766 ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY | | 767 ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY | |
767 HEADERS_FLAG_END_HEADERS)) { | 768 HEADERS_FLAG_END_HEADERS)) { |
768 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 769 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
769 } | 770 } |
770 } | 771 } |
771 break; | 772 break; |
772 case WINDOW_UPDATE: | 773 case WINDOW_UPDATE: |
773 if (current_frame_length_ != GetWindowUpdateSize()) { | 774 if (current_frame_length_ != GetWindowUpdateSize()) { |
774 set_error(SPDY_INVALID_CONTROL_FRAME); | 775 set_error(SPDY_INVALID_CONTROL_FRAME); |
775 } else if (current_frame_flags_ != 0) { | 776 } else if (current_frame_flags_ != 0) { |
776 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 777 // TODO(akalin): Implement END_FLOW_CONTROL handling. |
| 778 // set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
777 } | 779 } |
778 break; | 780 break; |
779 case CREDENTIAL: | 781 case CREDENTIAL: |
780 if (current_frame_length_ < GetCredentialMinimumSize()) { | 782 if (current_frame_length_ < GetCredentialMinimumSize()) { |
781 set_error(SPDY_INVALID_CONTROL_FRAME); | 783 set_error(SPDY_INVALID_CONTROL_FRAME); |
782 } else if (current_frame_flags_ != 0) { | 784 } else if (current_frame_flags_ != 0) { |
783 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 785 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
784 } | 786 } |
785 break; | 787 break; |
786 case BLOCKED: | 788 case BLOCKED: |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 switch (id_and_flags.id()) { | 1396 switch (id_and_flags.id()) { |
1395 case SETTINGS_UPLOAD_BANDWIDTH: | 1397 case SETTINGS_UPLOAD_BANDWIDTH: |
1396 case SETTINGS_DOWNLOAD_BANDWIDTH: | 1398 case SETTINGS_DOWNLOAD_BANDWIDTH: |
1397 case SETTINGS_ROUND_TRIP_TIME: | 1399 case SETTINGS_ROUND_TRIP_TIME: |
1398 case SETTINGS_MAX_CONCURRENT_STREAMS: | 1400 case SETTINGS_MAX_CONCURRENT_STREAMS: |
1399 case SETTINGS_CURRENT_CWND: | 1401 case SETTINGS_CURRENT_CWND: |
1400 case SETTINGS_DOWNLOAD_RETRANS_RATE: | 1402 case SETTINGS_DOWNLOAD_RETRANS_RATE: |
1401 case SETTINGS_INITIAL_WINDOW_SIZE: | 1403 case SETTINGS_INITIAL_WINDOW_SIZE: |
1402 // Valid values. | 1404 // Valid values. |
1403 break; | 1405 break; |
| 1406 case SETTINGS_FLOW_CONTROL_OPTIONS: |
| 1407 // TODO(akalin): Implement this. |
| 1408 break; |
1404 default: | 1409 default: |
1405 DLOG(WARNING) << "Unknown SETTINGS ID: " << id_and_flags.id(); | 1410 DLOG(WARNING) << "Unknown SETTINGS ID: " << id_and_flags.id(); |
1406 return false; | 1411 return false; |
1407 } | 1412 } |
1408 SpdySettingsIds id = static_cast<SpdySettingsIds>(id_and_flags.id()); | 1413 SpdySettingsIds id = static_cast<SpdySettingsIds>(id_and_flags.id()); |
1409 | 1414 |
1410 // Detect duplciates. | 1415 // Detect duplciates. |
1411 if (static_cast<uint32>(id) <= settings_scratch_.last_setting_id) { | 1416 if (static_cast<uint32>(id) <= settings_scratch_.last_setting_id) { |
1412 DLOG(WARNING) << "Duplicate entry or invalid ordering for id " << id | 1417 DLOG(WARNING) << "Duplicate entry or invalid ordering for id " << id |
1413 << " in " << display_protocol_ << " SETTINGS frame " | 1418 << " in " << display_protocol_ << " SETTINGS frame " |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2488 builder->Seek(compressed_size); | 2493 builder->Seek(compressed_size); |
2489 builder->RewriteLength(*this); | 2494 builder->RewriteLength(*this); |
2490 | 2495 |
2491 pre_compress_bytes.Add(uncompressed_len); | 2496 pre_compress_bytes.Add(uncompressed_len); |
2492 post_compress_bytes.Add(compressed_size); | 2497 post_compress_bytes.Add(compressed_size); |
2493 | 2498 |
2494 compressed_frames.Increment(); | 2499 compressed_frames.Increment(); |
2495 } | 2500 } |
2496 | 2501 |
2497 } // namespace net | 2502 } // namespace net |
OLD | NEW |