Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: net/spdy/spdy_framer.cc

Issue 243613003: Refactor GOAWAY status code handling, also handle SPDY4/HTTP2 status codes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor build fixes. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/spdy/spdy_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
1747 reader.Seek(GetControlFrameHeaderSize()); // Seek past frame header. 1747 reader.Seek(GetControlFrameHeaderSize()); // Seek past frame header.
1748 bool successful_read = reader.ReadUInt31(&current_frame_stream_id_); 1748 bool successful_read = reader.ReadUInt31(&current_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
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
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698