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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 size_t SpdyFramer::GetSynStreamMinimumSize() const { | 173 size_t SpdyFramer::GetSynStreamMinimumSize() const { |
174 // Size, in bytes, of a SYN_STREAM frame not including the variable-length | 174 // Size, in bytes, of a SYN_STREAM frame not including the variable-length |
175 // name-value block. | 175 // name-value block. |
176 if (spdy_version_ < 4) { | 176 if (spdy_version_ < 4) { |
177 // Calculated as: | 177 // Calculated as: |
178 // control frame header + 2 * 4 (stream IDs) + 1 (priority) + 1 (slot) | 178 // control frame header + 2 * 4 (stream IDs) + 1 (priority) + 1 (slot) |
179 return GetControlFrameHeaderSize() + 10; | 179 return GetControlFrameHeaderSize() + 10; |
180 } else { | 180 } else { |
181 // Calculated as: | 181 // Calculated as: |
182 // frame prefix + 4 (associated stream ID) + 1 (priority) + 1 (slot) | 182 // frame prefix + 4 (priority) |
183 return GetControlFrameHeaderSize() + 6; | 183 return GetControlFrameHeaderSize() + 4; |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 size_t SpdyFramer::GetSynReplyMinimumSize() const { | 187 size_t SpdyFramer::GetSynReplyMinimumSize() const { |
188 // Size, in bytes, of a SYN_REPLY frame not including the variable-length | 188 // Size, in bytes, of a SYN_REPLY frame not including the variable-length |
189 // name-value block. | 189 // name-value block. |
190 size_t size = GetControlFrameHeaderSize(); | 190 size_t size = GetControlFrameHeaderSize(); |
191 if (spdy_version_ < 4) { | 191 if (spdy_version_ < 4) { |
192 // Calculated as: | 192 // Calculated as: |
193 // control frame header + 4 (stream IDs) | 193 // control frame header + 4 (stream IDs) |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 676 |
677 if (current_frame_type_ == NOOP) { | 677 if (current_frame_type_ == NOOP) { |
678 DVLOG(1) << "NOOP control frame found. Ignoring."; | 678 DVLOG(1) << "NOOP control frame found. Ignoring."; |
679 CHANGE_STATE(SPDY_AUTO_RESET); | 679 CHANGE_STATE(SPDY_AUTO_RESET); |
680 return; | 680 return; |
681 } | 681 } |
682 | 682 |
683 // Do some sanity checking on the control frame sizes and flags. | 683 // Do some sanity checking on the control frame sizes and flags. |
684 switch (current_frame_type_) { | 684 switch (current_frame_type_) { |
685 case SYN_STREAM: | 685 case SYN_STREAM: |
| 686 DCHECK_GT(4, spdy_version_); |
686 if (current_frame_length_ < GetSynStreamMinimumSize()) { | 687 if (current_frame_length_ < GetSynStreamMinimumSize()) { |
687 set_error(SPDY_INVALID_CONTROL_FRAME); | 688 set_error(SPDY_INVALID_CONTROL_FRAME); |
688 } else if (current_frame_flags_ & | 689 } else if (current_frame_flags_ & |
689 ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) { | 690 ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) { |
690 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 691 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
691 } | 692 } |
692 break; | 693 break; |
693 case SYN_REPLY: | 694 case SYN_REPLY: |
694 if (current_frame_length_ < GetSynReplyMinimumSize()) { | 695 if (current_frame_length_ < GetSynReplyMinimumSize()) { |
695 set_error(SPDY_INVALID_CONTROL_FRAME); | 696 set_error(SPDY_INVALID_CONTROL_FRAME); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 case GOAWAY: | 728 case GOAWAY: |
728 { | 729 { |
729 if (current_frame_length_ != GetGoAwaySize()) { | 730 if (current_frame_length_ != GetGoAwaySize()) { |
730 set_error(SPDY_INVALID_CONTROL_FRAME); | 731 set_error(SPDY_INVALID_CONTROL_FRAME); |
731 } else if (current_frame_flags_ != 0) { | 732 } else if (current_frame_flags_ != 0) { |
732 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 733 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
733 } | 734 } |
734 break; | 735 break; |
735 } | 736 } |
736 case HEADERS: | 737 case HEADERS: |
737 if (current_frame_length_ < GetHeadersMinimumSize()) { | 738 { |
738 set_error(SPDY_INVALID_CONTROL_FRAME); | 739 size_t min_size = GetHeadersMinimumSize(); |
739 } else if (current_frame_flags_ & ~CONTROL_FLAG_FIN) { | 740 if (spdy_version_ > 3 && |
740 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 741 (current_frame_flags_ & HEADERS_FLAG_PRIORITY)) { |
| 742 min_size += 4; |
| 743 } |
| 744 if (current_frame_length_ < min_size) { |
| 745 set_error(SPDY_INVALID_CONTROL_FRAME); |
| 746 } else if (spdy_version_ < 4 && |
| 747 current_frame_flags_ & ~CONTROL_FLAG_FIN) { |
| 748 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
| 749 } else if (spdy_version_ > 3 && current_frame_flags_ & |
| 750 ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY)) { |
| 751 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
| 752 } |
741 } | 753 } |
742 break; | 754 break; |
743 case WINDOW_UPDATE: | 755 case WINDOW_UPDATE: |
744 if (current_frame_length_ != GetWindowUpdateSize()) { | 756 if (current_frame_length_ != GetWindowUpdateSize()) { |
745 set_error(SPDY_INVALID_CONTROL_FRAME); | 757 set_error(SPDY_INVALID_CONTROL_FRAME); |
746 } else if (current_frame_flags_ != 0) { | 758 } else if (current_frame_flags_ != 0) { |
747 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); | 759 set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS); |
748 } | 760 } |
749 break; | 761 break; |
750 case CREDENTIAL: | 762 case CREDENTIAL: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 break; | 820 break; |
809 case SYN_REPLY: | 821 case SYN_REPLY: |
810 syn_frame_processed_ = true; | 822 syn_frame_processed_ = true; |
811 frame_size_without_variable_data = GetSynReplyMinimumSize(); | 823 frame_size_without_variable_data = GetSynReplyMinimumSize(); |
812 break; | 824 break; |
813 case SETTINGS: | 825 case SETTINGS: |
814 frame_size_without_variable_data = GetSettingsMinimumSize(); | 826 frame_size_without_variable_data = GetSettingsMinimumSize(); |
815 break; | 827 break; |
816 case HEADERS: | 828 case HEADERS: |
817 frame_size_without_variable_data = GetHeadersMinimumSize(); | 829 frame_size_without_variable_data = GetHeadersMinimumSize(); |
| 830 if (spdy_version_ > 3 && current_frame_flags_ & HEADERS_FLAG_PRIORITY) { |
| 831 frame_size_without_variable_data += 4; // priority |
| 832 } |
818 break; | 833 break; |
819 case PUSH_PROMISE: | 834 case PUSH_PROMISE: |
820 frame_size_without_variable_data = GetPushPromiseMinimumSize(); | 835 frame_size_without_variable_data = GetPushPromiseMinimumSize(); |
821 break; | 836 break; |
822 default: | 837 default: |
823 frame_size_without_variable_data = -1; | 838 frame_size_without_variable_data = -1; |
824 break; | 839 break; |
825 } | 840 } |
826 | 841 |
827 if ((frame_size_without_variable_data == -1) && | 842 if ((frame_size_without_variable_data == -1) && |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 z->avail_in = 0; | 1085 z->avail_in = 0; |
1071 int rv = deflate(z, Z_SYNC_FLUSH); | 1086 int rv = deflate(z, Z_SYNC_FLUSH); |
1072 DCHECK_EQ(Z_OK, rv); | 1087 DCHECK_EQ(Z_OK, rv); |
1073 z->clas = kZStandardData; | 1088 z->clas = kZStandardData; |
1074 } | 1089 } |
1075 #endif // !defined(USE_SYSTEM_ZLIB) | 1090 #endif // !defined(USE_SYSTEM_ZLIB) |
1076 | 1091 |
1077 size_t SpdyFramer::ProcessControlFrameBeforeHeaderBlock(const char* data, | 1092 size_t SpdyFramer::ProcessControlFrameBeforeHeaderBlock(const char* data, |
1078 size_t len) { | 1093 size_t len) { |
1079 DCHECK_EQ(SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK, state_); | 1094 DCHECK_EQ(SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK, state_); |
1080 size_t original_len = len; | 1095 const size_t original_len = len; |
1081 | 1096 |
1082 if (remaining_control_header_ > 0) { | 1097 if (remaining_control_header_ > 0) { |
1083 size_t bytes_read = UpdateCurrentFrameBuffer(&data, &len, | 1098 size_t bytes_read = UpdateCurrentFrameBuffer(&data, &len, |
1084 remaining_control_header_); | 1099 remaining_control_header_); |
1085 remaining_control_header_ -= bytes_read; | 1100 remaining_control_header_ -= bytes_read; |
1086 remaining_data_length_ -= bytes_read; | 1101 remaining_data_length_ -= bytes_read; |
1087 } | 1102 } |
1088 | 1103 |
1089 if (remaining_control_header_ == 0) { | 1104 if (remaining_control_header_ == 0) { |
1090 SpdyFrameReader reader(current_frame_buffer_.get(), | 1105 SpdyFrameReader reader(current_frame_buffer_.get(), |
1091 current_frame_buffer_length_); | 1106 current_frame_buffer_length_); |
1092 reader.Seek(GetControlFrameHeaderSize()); // Seek past frame header. | 1107 reader.Seek(GetControlFrameHeaderSize()); // Seek past frame header. |
1093 | 1108 |
1094 switch (current_frame_type_) { | 1109 switch (current_frame_type_) { |
1095 case SYN_STREAM: | 1110 case SYN_STREAM: |
1096 { | 1111 { |
| 1112 DCHECK_GT(4, spdy_version_); |
1097 bool successful_read = true; | 1113 bool successful_read = true; |
1098 if (spdy_version_ < 4) { | 1114 if (spdy_version_ < 4) { |
1099 successful_read = reader.ReadUInt31(¤t_frame_stream_id_); | 1115 successful_read = reader.ReadUInt31(¤t_frame_stream_id_); |
1100 DCHECK(successful_read); | 1116 DCHECK(successful_read); |
1101 } | 1117 } |
1102 if (current_frame_stream_id_ == 0) { | 1118 if (current_frame_stream_id_ == 0) { |
1103 set_error(SPDY_INVALID_CONTROL_FRAME); | 1119 set_error(SPDY_INVALID_CONTROL_FRAME); |
1104 break; | 1120 break; |
1105 } | 1121 } |
1106 | 1122 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 break; | 1161 break; |
1146 case SETTINGS: | 1162 case SETTINGS: |
1147 visitor_->OnSettings(current_frame_flags_ & | 1163 visitor_->OnSettings(current_frame_flags_ & |
1148 SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS); | 1164 SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS); |
1149 CHANGE_STATE(SPDY_SETTINGS_FRAME_PAYLOAD); | 1165 CHANGE_STATE(SPDY_SETTINGS_FRAME_PAYLOAD); |
1150 break; | 1166 break; |
1151 case SYN_REPLY: | 1167 case SYN_REPLY: |
1152 case HEADERS: | 1168 case HEADERS: |
1153 // SYN_REPLY and HEADERS are the same, save for the visitor call. | 1169 // SYN_REPLY and HEADERS are the same, save for the visitor call. |
1154 { | 1170 { |
| 1171 if (spdy_version_ > 3) { |
| 1172 DCHECK_EQ(HEADERS, current_frame_type_); |
| 1173 } |
1155 bool successful_read = true; | 1174 bool successful_read = true; |
1156 if (spdy_version_ < 4) { | 1175 if (spdy_version_ < 4) { |
1157 successful_read = reader.ReadUInt31(¤t_frame_stream_id_); | 1176 successful_read = reader.ReadUInt31(¤t_frame_stream_id_); |
1158 DCHECK(successful_read); | 1177 DCHECK(successful_read); |
1159 } | 1178 } |
1160 if (current_frame_stream_id_ == 0) { | 1179 if (current_frame_stream_id_ == 0) { |
1161 set_error(SPDY_INVALID_CONTROL_FRAME); | 1180 set_error(SPDY_INVALID_CONTROL_FRAME); |
1162 break; | 1181 break; |
1163 } | 1182 } |
1164 if (protocol_version() < 3) { | 1183 if (protocol_version() < 3) { |
1165 // SPDY 2 had two unused bytes here. Seek past them. | 1184 // SPDY 2 had two unused bytes here. Seek past them. |
1166 reader.Seek(2); | 1185 reader.Seek(2); |
1167 } | 1186 } |
| 1187 const bool has_priority = |
| 1188 (current_frame_flags_ & HEADERS_FLAG_PRIORITY) != 0; |
| 1189 uint32 priority = 0; |
| 1190 if (protocol_version() > 3 && has_priority) { |
| 1191 successful_read = reader.ReadUInt31(&priority); |
| 1192 DCHECK(successful_read); |
| 1193 } |
1168 DCHECK(reader.IsDoneReading()); | 1194 DCHECK(reader.IsDoneReading()); |
1169 if (debug_visitor_) { | 1195 if (debug_visitor_) { |
| 1196 // SPDY 4 reports HEADERS with PRIORITY as SYN_STREAM. |
| 1197 SpdyFrameType reported_type = current_frame_type_; |
| 1198 if (protocol_version() > 3 && has_priority) { |
| 1199 reported_type = SYN_STREAM; |
| 1200 } |
1170 debug_visitor_->OnReceiveCompressedFrame( | 1201 debug_visitor_->OnReceiveCompressedFrame( |
1171 current_frame_stream_id_, | 1202 current_frame_stream_id_, |
1172 current_frame_type_, | 1203 reported_type, |
1173 current_frame_length_); | 1204 current_frame_length_); |
1174 } | 1205 } |
1175 if (current_frame_type_ == SYN_REPLY) { | 1206 if (current_frame_type_ == SYN_REPLY) { |
1176 visitor_->OnSynReply( | 1207 visitor_->OnSynReply( |
1177 current_frame_stream_id_, | 1208 current_frame_stream_id_, |
1178 (current_frame_flags_ & CONTROL_FLAG_FIN) != 0); | 1209 (current_frame_flags_ & CONTROL_FLAG_FIN) != 0); |
| 1210 } else if (spdy_version_ > 3 && |
| 1211 current_frame_flags_ & HEADERS_FLAG_PRIORITY) { |
| 1212 // SPDY 4+ is missing SYN_STREAM. Simulate it so that API changes |
| 1213 // can be made independent of wire changes. |
| 1214 visitor_->OnSynStream( |
| 1215 current_frame_stream_id_, |
| 1216 0, // associated_to_stream_id |
| 1217 priority, |
| 1218 0, // TODO(hkhalil): handle slot for SPDY 4+? |
| 1219 current_frame_flags_ & CONTROL_FLAG_FIN, |
| 1220 false); // unidirectional |
1179 } else { | 1221 } else { |
1180 visitor_->OnHeaders( | 1222 visitor_->OnHeaders( |
1181 current_frame_stream_id_, | 1223 current_frame_stream_id_, |
1182 (current_frame_flags_ & CONTROL_FLAG_FIN) != 0); | 1224 (current_frame_flags_ & CONTROL_FLAG_FIN) != 0); |
1183 } | 1225 } |
1184 } | 1226 } |
1185 CHANGE_STATE(SPDY_CONTROL_FRAME_HEADER_BLOCK); | 1227 CHANGE_STATE(SPDY_CONTROL_FRAME_HEADER_BLOCK); |
1186 break; | 1228 break; |
1187 case PUSH_PROMISE: | 1229 case PUSH_PROMISE: |
1188 { | 1230 { |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 return SerializeSynStream(syn_stream); | 1698 return SerializeSynStream(syn_stream); |
1657 } | 1699 } |
1658 | 1700 |
1659 SpdySerializedFrame* SpdyFramer::SerializeSynStream( | 1701 SpdySerializedFrame* SpdyFramer::SerializeSynStream( |
1660 const SpdySynStreamIR& syn_stream) { | 1702 const SpdySynStreamIR& syn_stream) { |
1661 uint8 flags = 0; | 1703 uint8 flags = 0; |
1662 if (syn_stream.fin()) { | 1704 if (syn_stream.fin()) { |
1663 flags |= CONTROL_FLAG_FIN; | 1705 flags |= CONTROL_FLAG_FIN; |
1664 } | 1706 } |
1665 if (syn_stream.unidirectional()) { | 1707 if (syn_stream.unidirectional()) { |
| 1708 // TODO(hkhalil): invalid for HTTP2. |
1666 flags |= CONTROL_FLAG_UNIDIRECTIONAL; | 1709 flags |= CONTROL_FLAG_UNIDIRECTIONAL; |
1667 } | 1710 } |
| 1711 if (spdy_version_ >= 4) { |
| 1712 flags |= HEADERS_FLAG_PRIORITY; |
| 1713 } |
| 1714 |
| 1715 // Sanitize priority. |
| 1716 uint8 priority = syn_stream.priority(); |
| 1717 if (priority > GetLowestPriority()) { |
| 1718 DLOG(DFATAL) << "Priority out-of-bounds."; |
| 1719 priority = GetLowestPriority(); |
| 1720 } |
1668 | 1721 |
1669 // The size of this frame, including variable-length name-value block. | 1722 // The size of this frame, including variable-length name-value block. |
1670 const size_t size = GetSynStreamMinimumSize() | 1723 const size_t size = GetSynStreamMinimumSize() |
1671 + GetSerializedLength(syn_stream.name_value_block()); | 1724 + GetSerializedLength(syn_stream.name_value_block()); |
1672 | 1725 |
1673 SpdyFrameBuilder builder(size); | 1726 SpdyFrameBuilder builder(size); |
1674 if (spdy_version_ < 4) { | 1727 if (spdy_version_ < 4) { |
1675 builder.WriteControlFrameHeader(*this, SYN_STREAM, flags); | 1728 builder.WriteControlFrameHeader(*this, SYN_STREAM, flags); |
1676 builder.WriteUInt32(syn_stream.stream_id()); | 1729 builder.WriteUInt32(syn_stream.stream_id()); |
| 1730 builder.WriteUInt32(syn_stream.associated_to_stream_id()); |
| 1731 builder.WriteUInt8(priority << ((spdy_version_ < 3) ? 6 : 5)); |
| 1732 builder.WriteUInt8(syn_stream.slot()); |
1677 } else { | 1733 } else { |
1678 builder.WriteFramePrefix(*this, | 1734 builder.WriteFramePrefix(*this, |
1679 SYN_STREAM, | 1735 HEADERS, |
1680 flags, | 1736 flags, |
1681 syn_stream.stream_id()); | 1737 syn_stream.stream_id()); |
| 1738 builder.WriteUInt32(priority); |
1682 } | 1739 } |
1683 builder.WriteUInt32(syn_stream.associated_to_stream_id()); | |
1684 uint8 priority = syn_stream.priority(); | |
1685 if (priority > GetLowestPriority()) { | |
1686 DLOG(DFATAL) << "Priority out-of-bounds."; | |
1687 priority = GetLowestPriority(); | |
1688 } | |
1689 builder.WriteUInt8(priority << ((spdy_version_ < 3) ? 6 : 5)); | |
1690 builder.WriteUInt8(syn_stream.slot()); | |
1691 DCHECK_EQ(GetSynStreamMinimumSize(), builder.length()); | 1740 DCHECK_EQ(GetSynStreamMinimumSize(), builder.length()); |
1692 SerializeNameValueBlock(&builder, syn_stream); | 1741 SerializeNameValueBlock(&builder, syn_stream); |
1693 | 1742 |
1694 if (debug_visitor_) { | 1743 if (debug_visitor_) { |
1695 const size_t payload_len = GetSerializedLength( | 1744 const size_t payload_len = GetSerializedLength( |
1696 protocol_version(), &(syn_stream.name_value_block())); | 1745 protocol_version(), &(syn_stream.name_value_block())); |
| 1746 // SPDY 4 reports this compression as a SYN_STREAM compression. |
1697 debug_visitor_->OnSendCompressedFrame(syn_stream.stream_id(), | 1747 debug_visitor_->OnSendCompressedFrame(syn_stream.stream_id(), |
1698 SYN_STREAM, | 1748 SYN_STREAM, |
1699 payload_len, | 1749 payload_len, |
1700 builder.length()); | 1750 builder.length()); |
1701 } | 1751 } |
1702 | 1752 |
1703 return builder.take(); | 1753 return builder.take(); |
1704 } | 1754 } |
1705 | 1755 |
1706 SpdyFrame* SpdyFramer::CreateSynReply( | 1756 SpdyFrame* SpdyFramer::CreateSynReply( |
(...skipping 20 matching lines...) Expand all Loading... |
1727 // The size of this frame, including variable-length name-value block. | 1777 // The size of this frame, including variable-length name-value block. |
1728 size_t size = GetSynReplyMinimumSize() | 1778 size_t size = GetSynReplyMinimumSize() |
1729 + GetSerializedLength(syn_reply.name_value_block()); | 1779 + GetSerializedLength(syn_reply.name_value_block()); |
1730 | 1780 |
1731 SpdyFrameBuilder builder(size); | 1781 SpdyFrameBuilder builder(size); |
1732 if (spdy_version_ < 4) { | 1782 if (spdy_version_ < 4) { |
1733 builder.WriteControlFrameHeader(*this, SYN_REPLY, flags); | 1783 builder.WriteControlFrameHeader(*this, SYN_REPLY, flags); |
1734 builder.WriteUInt32(syn_reply.stream_id()); | 1784 builder.WriteUInt32(syn_reply.stream_id()); |
1735 } else { | 1785 } else { |
1736 builder.WriteFramePrefix(*this, | 1786 builder.WriteFramePrefix(*this, |
1737 SYN_REPLY, | 1787 HEADERS, |
1738 flags, | 1788 flags, |
1739 syn_reply.stream_id()); | 1789 syn_reply.stream_id()); |
1740 } | 1790 } |
1741 if (protocol_version() < 3) { | 1791 if (protocol_version() < 3) { |
1742 builder.WriteUInt16(0); // Unused. | 1792 builder.WriteUInt16(0); // Unused. |
1743 } | 1793 } |
1744 DCHECK_EQ(GetSynReplyMinimumSize(), builder.length()); | 1794 DCHECK_EQ(GetSynReplyMinimumSize(), builder.length()); |
1745 SerializeNameValueBlock(&builder, syn_reply); | 1795 SerializeNameValueBlock(&builder, syn_reply); |
1746 | 1796 |
1747 if (debug_visitor_) { | 1797 if (debug_visitor_) { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 builder->Seek(compressed_size); | 2399 builder->Seek(compressed_size); |
2350 builder->RewriteLength(*this); | 2400 builder->RewriteLength(*this); |
2351 | 2401 |
2352 pre_compress_bytes.Add(uncompressed_len); | 2402 pre_compress_bytes.Add(uncompressed_len); |
2353 post_compress_bytes.Add(compressed_size); | 2403 post_compress_bytes.Add(compressed_size); |
2354 | 2404 |
2355 compressed_frames.Increment(); | 2405 compressed_frames.Increment(); |
2356 } | 2406 } |
2357 | 2407 |
2358 } // namespace net | 2408 } // namespace net |
OLD | NEW |