| 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 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 reader.Seek(GetControlFrameHeaderSize()); // Seek past frame header. | 1747 reader.Seek(GetControlFrameHeaderSize()); // Seek past frame header. |
| 1748 bool successful_read = reader.ReadUInt31(¤t_frame_stream_id_); | 1748 bool successful_read = reader.ReadUInt31(¤t_frame_stream_id_); |
| 1749 DCHECK(successful_read); | 1749 DCHECK(successful_read); |
| 1750 | 1750 |
| 1751 // In SPDYv3 and up, frames also specify a status code - parse it out. | 1751 // In SPDYv3 and up, frames also specify a status code - parse it out. |
| 1752 SpdyGoAwayStatus status = GOAWAY_OK; | 1752 SpdyGoAwayStatus status = GOAWAY_OK; |
| 1753 if (protocol_version() >= SPDY3) { | 1753 if (protocol_version() >= SPDY3) { |
| 1754 uint32 status_raw = GOAWAY_OK; | 1754 uint32 status_raw = GOAWAY_OK; |
| 1755 successful_read = reader.ReadUInt32(&status_raw); | 1755 successful_read = reader.ReadUInt32(&status_raw); |
| 1756 DCHECK(successful_read); | 1756 DCHECK(successful_read); |
| 1757 // We've read an unsigned integer, so it's enough to only check | 1757 if (SpdyConstants::IsValidGoAwayStatus(protocol_version(), |
| 1758 // upper bound to ensure the value is in valid range. | 1758 status_raw)) { |
| 1759 if (status_raw < GOAWAY_NUM_STATUS_CODES) { | 1759 status = SpdyConstants::ParseGoAwayStatus(protocol_version(), |
| 1760 status = static_cast<SpdyGoAwayStatus>(status_raw); | 1760 status_raw); |
| 1761 } else { | 1761 } else { |
| 1762 // TODO(hkhalil): Probably best to OnError here, depending on | 1762 // TODO(hkhalil): Probably best to OnError here, depending on |
| 1763 // our interpretation of the spec. Keeping with existing liberal | 1763 // our interpretation of the spec. Keeping with existing liberal |
| 1764 // behavior for now. | 1764 // behavior for now. |
| 1765 DCHECK(false); | 1765 DCHECK(false); |
| 1766 } | 1766 } |
| 1767 } | 1767 } |
| 1768 // Finished parsing the GOAWAY header, call frame handler. | 1768 // Finished parsing the GOAWAY header, call frame handler. |
| 1769 visitor_->OnGoAway(current_frame_stream_id_, status); | 1769 visitor_->OnGoAway(current_frame_stream_id_, status); |
| 1770 } | 1770 } |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 builder->Seek(compressed_size); | 2843 builder->Seek(compressed_size); |
| 2844 builder->RewriteLength(*this); | 2844 builder->RewriteLength(*this); |
| 2845 | 2845 |
| 2846 pre_compress_bytes.Add(uncompressed_len); | 2846 pre_compress_bytes.Add(uncompressed_len); |
| 2847 post_compress_bytes.Add(compressed_size); | 2847 post_compress_bytes.Add(compressed_size); |
| 2848 | 2848 |
| 2849 compressed_frames.Increment(); | 2849 compressed_frames.Increment(); |
| 2850 } | 2850 } |
| 2851 | 2851 |
| 2852 } // namespace net | 2852 } // namespace net |
| OLD | NEW |