| 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/quic/quic_packet_creator.h" | 5 #include "net/quic/quic_packet_creator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 167 } |
| 168 CreateStreamFrame(id, iov, iov_offset, offset, fin, frame); | 168 CreateStreamFrame(id, iov, iov_offset, offset, fin, frame); |
| 169 // Explicitly disallow multi-packet CHLOs. | 169 // Explicitly disallow multi-packet CHLOs. |
| 170 if (FLAGS_quic_disallow_multi_packet_chlo && id == kCryptoStreamId && | 170 if (FLAGS_quic_disallow_multi_packet_chlo && id == kCryptoStreamId && |
| 171 frame->stream_frame->data_length >= sizeof(kCHLO) && | 171 frame->stream_frame->data_length >= sizeof(kCHLO) && |
| 172 strncmp(frame->stream_frame->data_buffer, | 172 strncmp(frame->stream_frame->data_buffer, |
| 173 reinterpret_cast<const char*>(&kCHLO), sizeof(kCHLO)) == 0) { | 173 reinterpret_cast<const char*>(&kCHLO), sizeof(kCHLO)) == 0) { |
| 174 DCHECK_EQ(static_cast<size_t>(0), iov_offset); | 174 DCHECK_EQ(static_cast<size_t>(0), iov_offset); |
| 175 if (frame->stream_frame->data_length < iov.iov->iov_len) { | 175 if (frame->stream_frame->data_length < iov.iov->iov_len) { |
| 176 const string error_details = "Client hello won't fit in a single packet."; | 176 const string error_details = "Client hello won't fit in a single packet."; |
| 177 QUIC_BUG << error_details; | 177 QUIC_BUG << error_details << " Constructed stream frame length: " |
| 178 << frame->stream_frame->data_length |
| 179 << " CHLO length: " << iov.iov->iov_len; |
| 178 delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details, | 180 delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details, |
| 179 ConnectionCloseSource::FROM_SELF); | 181 ConnectionCloseSource::FROM_SELF); |
| 180 delete frame->stream_frame; | 182 delete frame->stream_frame; |
| 181 return false; | 183 return false; |
| 182 } | 184 } |
| 183 } | 185 } |
| 184 if (!AddFrame(*frame, /*save_retransmittable_frames=*/true)) { | 186 if (!AddFrame(*frame, /*save_retransmittable_frames=*/true)) { |
| 185 // Fails if we try to write unencrypted stream data. | 187 // Fails if we try to write unencrypted stream data. |
| 186 delete frame->stream_frame; | 188 delete frame->stream_frame; |
| 187 return false; | 189 return false; |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Switching path needs to update packet number length. | 631 // Switching path needs to update packet number length. |
| 630 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight); | 632 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight); |
| 631 } | 633 } |
| 632 | 634 |
| 633 bool QuicPacketCreator::IncludeNonceInPublicHeader() { | 635 bool QuicPacketCreator::IncludeNonceInPublicHeader() { |
| 634 return have_diversification_nonce_ && | 636 return have_diversification_nonce_ && |
| 635 packet_.encryption_level == ENCRYPTION_INITIAL; | 637 packet_.encryption_level == ENCRYPTION_INITIAL; |
| 636 } | 638 } |
| 637 | 639 |
| 638 } // namespace net | 640 } // namespace net |
| OLD | NEW |