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

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

Issue 12258006: Minor change in parsing of GOAWAY frames for correctness. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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_framer_test.cc » ('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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 reinterpret_cast<SpdyRstStreamControlFrame*>(&control_frame); 1212 reinterpret_cast<SpdyRstStreamControlFrame*>(&control_frame);
1213 visitor_->OnRstStream(rst_stream_frame->stream_id(), 1213 visitor_->OnRstStream(rst_stream_frame->stream_id(),
1214 rst_stream_frame->status()); 1214 rst_stream_frame->status());
1215 } 1215 }
1216 break; 1216 break;
1217 case GOAWAY: { 1217 case GOAWAY: {
1218 SpdyFrameReader reader(current_frame_buffer_.get(), 1218 SpdyFrameReader reader(current_frame_buffer_.get(),
1219 current_frame_len_); 1219 current_frame_len_);
1220 reader.Seek(GetControlFrameMinimumSize()); // Skip frame header. 1220 reader.Seek(GetControlFrameMinimumSize()); // Skip frame header.
1221 SpdyStreamId last_accepted_stream_id = kInvalidStream; 1221 SpdyStreamId last_accepted_stream_id = kInvalidStream;
1222 bool successful_read = reader.ReadUInt32(&last_accepted_stream_id); 1222 bool successful_read = reader.ReadUInt31(&last_accepted_stream_id);
1223 DCHECK(successful_read); 1223 DCHECK(successful_read);
1224 SpdyGoAwayStatus status = GOAWAY_OK; 1224 SpdyGoAwayStatus status = GOAWAY_OK;
1225 if (spdy_version_ >= 3) { 1225 if (spdy_version_ >= 3) {
1226 uint32 status_raw = GOAWAY_OK; 1226 uint32 status_raw = GOAWAY_OK;
1227 successful_read = reader.ReadUInt32(&status_raw); 1227 successful_read = reader.ReadUInt32(&status_raw);
1228 DCHECK(successful_read); 1228 DCHECK(successful_read);
1229 if (status_raw > static_cast<uint32>(GOAWAY_INVALID) && 1229 if (status_raw > static_cast<uint32>(GOAWAY_INVALID) &&
1230 status_raw < static_cast<uint32>(GOAWAY_NUM_STATUS_CODES)) { 1230 status_raw < static_cast<uint32>(GOAWAY_NUM_STATUS_CODES)) {
1231 status = static_cast<SpdyGoAwayStatus>(status_raw); 1231 status = static_cast<SpdyGoAwayStatus>(status_raw);
1232 } else { 1232 } else {
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 builder->WriteString(it->first); 2071 builder->WriteString(it->first);
2072 builder->WriteString(it->second); 2072 builder->WriteString(it->second);
2073 } else { 2073 } else {
2074 builder->WriteStringPiece32(it->first); 2074 builder->WriteStringPiece32(it->first);
2075 builder->WriteStringPiece32(it->second); 2075 builder->WriteStringPiece32(it->second);
2076 } 2076 }
2077 } 2077 }
2078 } 2078 }
2079 2079
2080 } // namespace net 2080 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698