summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 03:36:28 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 03:36:28 +0000
commit069220ebfb73762d3e3b2b1966a0abf22c054861 (patch)
tree1ca315a8586346dbf3da3756e0107e7ea441c567 /net
parentaa775e0f34b2410a497da57e200fe7ef8c53ba46 (diff)
downloadchromium_src-069220ebfb73762d3e3b2b1966a0abf22c054861.zip
chromium_src-069220ebfb73762d3e3b2b1966a0abf22c054861.tar.gz
chromium_src-069220ebfb73762d3e3b2b1966a0abf22c054861.tar.bz2
Remove SpdySynReplyControlFrame and SpdyGoAwayControlFrame.
Useful in SPDY 4 development. This lands server change 420065749. Review URL: https://codereview.chromium.org/12256004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/spdy/buffered_spdy_framer.cc4
-rw-r--r--net/spdy/buffered_spdy_framer.h10
-rw-r--r--net/spdy/buffered_spdy_framer_spdy2_unittest.cc4
-rw-r--r--net/spdy/buffered_spdy_framer_spdy3_unittest.cc4
-rw-r--r--net/spdy/spdy_frame_reader.cc40
-rw-r--r--net/spdy/spdy_frame_reader.h18
-rw-r--r--net/spdy/spdy_framer.cc83
-rw-r--r--net/spdy/spdy_framer.h18
-rw-r--r--net/spdy/spdy_framer_test.cc34
-rw-r--r--net/spdy/spdy_protocol.h42
-rw-r--r--net/spdy/spdy_protocol_test.cc81
-rw-r--r--net/tools/flip_server/spdy_interface.cc2
12 files changed, 151 insertions, 189 deletions
diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc
index 7f21b9a..0bba595 100644
--- a/net/spdy/buffered_spdy_framer.cc
+++ b/net/spdy/buffered_spdy_framer.cc
@@ -229,7 +229,7 @@ SpdySynStreamControlFrame* BufferedSpdyFramer::CreateSynStream(
headers);
}
-SpdySynReplyControlFrame* BufferedSpdyFramer::CreateSynReply(
+SpdyFrame* BufferedSpdyFramer::CreateSynReply(
SpdyStreamId stream_id,
SpdyControlFlags flags,
bool compressed,
@@ -253,7 +253,7 @@ SpdyPingControlFrame* BufferedSpdyFramer::CreatePingFrame(
return spdy_framer_.CreatePingFrame(unique_id);
}
-SpdyGoAwayControlFrame* BufferedSpdyFramer::CreateGoAway(
+SpdyFrame* BufferedSpdyFramer::CreateGoAway(
SpdyStreamId last_accepted_stream_id,
SpdyGoAwayStatus status) const {
return spdy_framer_.CreateGoAway(last_accepted_stream_id, status);
diff --git a/net/spdy/buffered_spdy_framer.h b/net/spdy/buffered_spdy_framer.h
index 588a07f..17630d0 100644
--- a/net/spdy/buffered_spdy_framer.h
+++ b/net/spdy/buffered_spdy_framer.h
@@ -154,15 +154,15 @@ class NET_EXPORT_PRIVATE BufferedSpdyFramer
SpdyControlFlags flags,
bool compressed,
const SpdyHeaderBlock* headers);
- SpdySynReplyControlFrame* CreateSynReply(SpdyStreamId stream_id,
- SpdyControlFlags flags,
- bool compressed,
- const SpdyHeaderBlock* headers);
+ SpdyFrame* CreateSynReply(SpdyStreamId stream_id,
+ SpdyControlFlags flags,
+ bool compressed,
+ const SpdyHeaderBlock* headers);
SpdyRstStreamControlFrame* CreateRstStream(SpdyStreamId stream_id,
SpdyRstStreamStatus status) const;
SpdySettingsControlFrame* CreateSettings(const SettingsMap& values) const;
SpdyPingControlFrame* CreatePingFrame(uint32 unique_id) const;
- SpdyGoAwayControlFrame* CreateGoAway(
+ SpdyFrame* CreateGoAway(
SpdyStreamId last_accepted_stream_id,
SpdyGoAwayStatus status) const;
SpdyHeadersControlFrame* CreateHeaders(SpdyStreamId stream_id,
diff --git a/net/spdy/buffered_spdy_framer_spdy2_unittest.cc b/net/spdy/buffered_spdy_framer_spdy2_unittest.cc
index 5a1f72f..af317f1 100644
--- a/net/spdy/buffered_spdy_framer_spdy2_unittest.cc
+++ b/net/spdy/buffered_spdy_framer_spdy2_unittest.cc
@@ -107,7 +107,7 @@ class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface {
}
void OnRstStream(const SpdyRstStreamControlFrame& frame) {}
- void OnGoAway(const SpdyGoAwayControlFrame& frame) {}
+ void OnGoAway(const SpdyFrame& frame) {}
void OnPing(const SpdyPingControlFrame& frame) {}
virtual void OnWindowUpdate(SpdyStreamId stream_id,
int delta_window_size) OVERRIDE {
@@ -233,7 +233,7 @@ TEST_F(BufferedSpdyFramerSpdy2Test, ReadSynReplyHeaderBlock) {
headers["alpha"] = "beta";
headers["gamma"] = "delta";
BufferedSpdyFramer framer(2, true);
- scoped_ptr<SpdySynReplyControlFrame> control_frame(
+ scoped_ptr<SpdyFrame> control_frame(
framer.CreateSynReply(1, // stream_id
CONTROL_FLAG_NONE,
true, // compress
diff --git a/net/spdy/buffered_spdy_framer_spdy3_unittest.cc b/net/spdy/buffered_spdy_framer_spdy3_unittest.cc
index c6dc5a2..d2f326a 100644
--- a/net/spdy/buffered_spdy_framer_spdy3_unittest.cc
+++ b/net/spdy/buffered_spdy_framer_spdy3_unittest.cc
@@ -105,7 +105,7 @@ class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface {
}
void OnRstStream(const SpdyRstStreamControlFrame& frame) {}
- void OnGoAway(const SpdyGoAwayControlFrame& frame) {}
+ void OnGoAway(const SpdyFrame& frame) {}
void OnPing(const SpdyPingControlFrame& frame) {}
virtual void OnWindowUpdate(SpdyStreamId stream_id,
int delta_window_size) OVERRIDE {
@@ -232,7 +232,7 @@ TEST_F(BufferedSpdyFramerSpdy3Test, ReadSynReplyHeaderBlock) {
headers["alpha"] = "beta";
headers["gamma"] = "delta";
BufferedSpdyFramer framer(3, true);
- scoped_ptr<SpdySynReplyControlFrame> control_frame(
+ scoped_ptr<SpdyFrame> control_frame(
framer.CreateSynReply(1, // stream_id
CONTROL_FLAG_NONE,
true, // compress
diff --git a/net/spdy/spdy_frame_reader.cc b/net/spdy/spdy_frame_reader.cc
index 57bf9eb..3765c69 100644
--- a/net/spdy/spdy_frame_reader.cc
+++ b/net/spdy/spdy_frame_reader.cc
@@ -6,6 +6,7 @@
#include "base/sys_byteorder.h"
#include "net/spdy/spdy_frame_reader.h"
+#include "net/spdy/spdy_protocol.h"
namespace net {
@@ -15,6 +16,22 @@ SpdyFrameReader::SpdyFrameReader(const char* data, const size_t len)
ofs_(0) {
}
+bool SpdyFrameReader::ReadUInt8(uint8* result) {
+ // Make sure that we have the whole uint8.
+ if (!CanRead(1)) {
+ OnFailure();
+ return false;
+ }
+
+ // Read into result.
+ *result = *reinterpret_cast<const uint8*>(data_ + ofs_);
+
+ // Iterate.
+ ofs_ += 1;
+
+ return true;
+}
+
bool SpdyFrameReader::ReadUInt16(uint16* result) {
// Make sure that we have the whole uint16.
if (!CanRead(2)) {
@@ -47,6 +64,17 @@ bool SpdyFrameReader::ReadUInt32(uint32* result) {
return true;
}
+bool SpdyFrameReader::ReadUInt31(uint32* result) {
+ bool success = ReadUInt32(result);
+
+ // Zero out highest-order bit.
+ if (success) {
+ *result &= kStreamIdMask;
+ }
+
+ return success;
+}
+
bool SpdyFrameReader::ReadStringPiece16(base::StringPiece* result) {
// Read resultant length.
uint16 result_len;
@@ -109,6 +137,18 @@ bool SpdyFrameReader::ReadBytes(void* result, size_t size) {
return true;
}
+bool SpdyFrameReader::Seek(size_t size) {
+ if (!CanRead(size)) {
+ OnFailure();
+ return false;
+ }
+
+ // Iterate.
+ ofs_ += size;
+
+ return true;
+}
+
bool SpdyFrameReader::IsDoneReading() const {
return len_ == ofs_;
}
diff --git a/net/spdy/spdy_frame_reader.h b/net/spdy/spdy_frame_reader.h
index 3d456b7..3f18456 100644
--- a/net/spdy/spdy_frame_reader.h
+++ b/net/spdy/spdy_frame_reader.h
@@ -33,6 +33,11 @@ class NET_EXPORT_PRIVATE SpdyFrameReader {
// Empty destructor.
~SpdyFrameReader() {}
+ // Reads an 8-bit unsigned integer into the given output parameter.
+ // Forwards the internal iterater on success.
+ // Returns true on success, false otherwise.
+ bool ReadUInt8(uint8* result);
+
// Reads a 16-bit unsigned integer into the given output parameter.
// Forwards the internal iterater on success.
// Returns true on success, false otherwise.
@@ -43,6 +48,13 @@ class NET_EXPORT_PRIVATE SpdyFrameReader {
// Returns true on success, false otherwise.
bool ReadUInt32(uint32* result);
+ // Reads a 31-bit unsigned integer into the given output parameter. This is
+ // equivelant to ReadUInt32() above except that the highest-order bit is
+ // discarded.
+ // Forwards the internal iterater (by 4B) on success.
+ // Returns true on success, false otherwise.
+ bool ReadUInt31(uint32* result);
+
// Reads a string prefixed with 16-bit length into the given output parameter.
//
// NOTE: Does not copy but rather references strings in the underlying buffer.
@@ -67,6 +79,12 @@ class NET_EXPORT_PRIVATE SpdyFrameReader {
// Returns true on success, false otherwise.
bool ReadBytes(void* result, size_t size);
+ // Seeks a given number of bytes into the buffer from the current offset.
+ // Equivelant to an empty read.
+ // Forwards the internal iterator.
+ // Returns true on success, false otherwise.
+ bool Seek(size_t size);
+
// Returns true if the entirety of the underlying buffer has been read via
// Read*() calls.
bool IsDoneReading() const;
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 53070f2..3e3d32b 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -671,11 +671,7 @@ void SpdyFramer::ProcessControlFrameHeader() {
break;
case SYN_REPLY:
syn_frame_processed_ = true;
- frame_size_without_variable_data = SpdySynReplyControlFrame::size();
- // SPDY 2 had two bytes of unused space preceeding payload.
- if (spdy_version_ < 3) {
- frame_size_without_variable_data += 2;
- }
+ frame_size_without_variable_data = GetSynReplyMinimumSize();
break;
case HEADERS:
frame_size_without_variable_data = SpdyHeadersControlFrame::size();
@@ -970,11 +966,22 @@ size_t SpdyFramer::ProcessControlFrameBeforeHeaderBlock(const char* data,
break;
case SYN_REPLY:
{
- SpdySynReplyControlFrame* syn_reply_frame =
- reinterpret_cast<SpdySynReplyControlFrame*>(&control_frame);
- visitor_->OnSynReply(
- syn_reply_frame->stream_id(),
- (syn_reply_frame->flags() & CONTROL_FLAG_FIN) != 0);
+ SpdyFrameReader reader(current_frame_buffer_.get(),
+ current_frame_len_);
+ reader.Seek(4); // Seek past control bit, type and version.
+ uint8 flags;
+ bool successful_read = reader.ReadUInt8(&flags);
+ DCHECK(successful_read);
+ reader.Seek(3); // Seek past length.
+ SpdyStreamId stream_id = kInvalidStream;
+ successful_read = reader.ReadUInt31(&stream_id);
+ DCHECK(successful_read);
+ if (protocol_version() < 3) {
+ // SPDY 2 had two unused bytes here. Seek past them.
+ reader.Seek(2);
+ }
+ DCHECK(reader.IsDoneReading());
+ visitor_->OnSynReply(stream_id, (flags & CONTROL_FLAG_FIN) != 0);
}
CHANGE_STATE(SPDY_CONTROL_FRAME_HEADER_BLOCK);
break;
@@ -1194,15 +1201,28 @@ size_t SpdyFramer::ProcessControlFramePayload(const char* data, size_t len) {
}
break;
case GOAWAY: {
- SpdyGoAwayControlFrame* go_away_frame =
- reinterpret_cast<SpdyGoAwayControlFrame*>(&control_frame);
- if (spdy_version_ < 3) {
- visitor_->OnGoAway(go_away_frame->last_accepted_stream_id(),
- GOAWAY_OK);
- } else {
- visitor_->OnGoAway(go_away_frame->last_accepted_stream_id(),
- go_away_frame->status());
+ SpdyFrameReader reader(current_frame_buffer_.get(),
+ current_frame_len_);
+ reader.Seek(GetControlFrameMinimumSize()); // Skip frame header.
+ SpdyStreamId last_accepted_stream_id = kInvalidStream;
+ bool successful_read = reader.ReadUInt32(&last_accepted_stream_id);
+ DCHECK(successful_read);
+ SpdyGoAwayStatus status = GOAWAY_OK;
+ if (spdy_version_ >= 3) {
+ uint32 status_raw = GOAWAY_OK;
+ successful_read = reader.ReadUInt32(&status_raw);
+ DCHECK(successful_read);
+ if (status_raw > static_cast<uint32>(GOAWAY_INVALID) &&
+ status_raw < static_cast<uint32>(GOAWAY_NUM_STATUS_CODES)) {
+ status = static_cast<SpdyGoAwayStatus>(status_raw);
+ } else {
+ // TODO(hkhalil): Probably best to OnError here, depending on
+ // our interpretation of the spec. Keeping with existing liberal
+ // behavior for now.
+ }
}
+ DCHECK(reader.IsDoneReading());
+ visitor_->OnGoAway(last_accepted_stream_id, status);
}
break;
default:
@@ -1434,7 +1454,7 @@ SpdySerializedFrame* SpdyFramer::SerializeSynStream(
return builder.take();
}
-SpdySynReplyControlFrame* SpdyFramer::CreateSynReply(
+SpdyFrame* SpdyFramer::CreateSynReply(
SpdyStreamId stream_id,
SpdyControlFlags flags,
bool compressed,
@@ -1446,12 +1466,10 @@ SpdySynReplyControlFrame* SpdyFramer::CreateSynReply(
// TODO(hkhalil): Avoid copy here.
*(syn_reply.GetMutableNameValueBlock()) = *headers;
- scoped_ptr<SpdySynReplyControlFrame> reply_frame(
- reinterpret_cast<SpdySynReplyControlFrame*>(SerializeSynReply(
- syn_reply)));
+ scoped_ptr<SpdyControlFrame> reply_frame(
+ reinterpret_cast<SpdyControlFrame*>(SerializeSynReply(syn_reply)));
if (compressed) {
- return reinterpret_cast<SpdySynReplyControlFrame*>(
- CompressControlFrame(*reply_frame.get(), headers));
+ return CompressControlFrame(*reply_frame.get(), headers);
}
return reply_frame.release();
}
@@ -1559,11 +1577,11 @@ SpdySerializedFrame* SpdyFramer::SerializePing(const SpdyPingIR& ping) const {
return builder.take();
}
-SpdyGoAwayControlFrame* SpdyFramer::CreateGoAway(
+SpdyFrame* SpdyFramer::CreateGoAway(
SpdyStreamId last_accepted_stream_id,
SpdyGoAwayStatus status) const {
SpdyGoAwayIR goaway(last_accepted_stream_id, status);
- return reinterpret_cast<SpdyGoAwayControlFrame*>(SerializeGoAway(goaway));
+ return SerializeGoAway(goaway);
}
SpdySerializedFrame* SpdyFramer::SerializeGoAway(
@@ -1791,17 +1809,10 @@ bool SpdyFramer::GetFrameBoundaries(const SpdyFrame& frame,
break;
case SYN_REPLY:
{
- const SpdySynReplyControlFrame& syn_frame =
- reinterpret_cast<const SpdySynReplyControlFrame&>(frame);
- frame_size = SpdySynReplyControlFrame::size();
- *payload_length = syn_frame.header_block_len();
- *header_length = frame_size;
+ *header_length = GetSynReplyMinimumSize();
+ *payload_length = frame.length() -
+ (*header_length - GetControlFrameMinimumSize());
*payload = frame.data() + *header_length;
- // SPDY 2 had two bytes of unused space preceeding payload.
- if (spdy_version_ < 3) {
- *header_length += 2;
- *payload += 2;
- }
}
break;
case HEADERS:
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
index 9cef56c..9facf60 100644
--- a/net/spdy/spdy_framer.h
+++ b/net/spdy/spdy_framer.h
@@ -368,16 +368,16 @@ class NET_EXPORT_PRIVATE SpdyFramer {
const SpdyHeaderBlock* headers);
SpdySerializedFrame* SerializeSynStream(const SpdySynStreamIR& syn_stream);
- // Create a SpdySynReplyControlFrame.
+ // Create a SYN_REPLY SpdyFrame.
// |stream_id| is the stream for this frame.
// |flags| is the flags to use with the data.
// To mark this frame as the last frame, enable CONTROL_FLAG_FIN.
// |compressed| specifies whether the frame should be compressed.
// |headers| is the header block to include in the frame.
- SpdySynReplyControlFrame* CreateSynReply(SpdyStreamId stream_id,
- SpdyControlFlags flags,
- bool compressed,
- const SpdyHeaderBlock* headers);
+ SpdyFrame* CreateSynReply(SpdyStreamId stream_id,
+ SpdyControlFlags flags,
+ bool compressed,
+ const SpdyHeaderBlock* headers);
SpdySerializedFrame* SerializeSynReply(const SpdySynReplyIR& syn_reply);
SpdyRstStreamControlFrame* CreateRstStream(SpdyStreamId stream_id,
@@ -395,12 +395,12 @@ class NET_EXPORT_PRIVATE SpdyFramer {
SpdyPingControlFrame* CreatePingFrame(uint32 unique_id) const;
SpdySerializedFrame* SerializePing(const SpdyPingIR& ping) const;
- // Creates an instance of SpdyGoAwayControlFrame. The GOAWAY frame is used
+ // Creates and serializes a GOAWAY frame. The GOAWAY frame is used
// prior to the shutting down of the TCP connection, and includes the
// stream_id of the last stream the sender of the frame is willing to process
// to completion.
- SpdyGoAwayControlFrame* CreateGoAway(SpdyStreamId last_accepted_stream_id,
- SpdyGoAwayStatus status) const;
+ SpdyFrame* CreateGoAway(SpdyStreamId last_accepted_stream_id,
+ SpdyGoAwayStatus status) const;
SpdySerializedFrame* SerializeGoAway(const SpdyGoAwayIR& goaway) const;
// Creates an instance of SpdyHeadersControlFrame. The HEADERS frame is used
@@ -591,6 +591,8 @@ class NET_EXPORT_PRIVATE SpdyFramer {
// Set the error code and moves the framer into the error state.
void set_error(SpdyError error);
+ size_t GoAwaySize() const;
+
// Given a frame, breakdown the variable payload length, the static header
// header length, and variable payload pointer.
bool GetFrameBoundaries(const SpdyFrame& frame, int* payload_length,
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index 0aaf2bd1..77386a2 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -2168,7 +2168,7 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
- scoped_ptr<SpdyGoAwayControlFrame> frame(framer.CreateGoAway(0, GOAWAY_OK));
+ scoped_ptr<SpdyFrame> frame(framer.CreateGoAway(0, GOAWAY_OK));
CompareFrame(kDescription,
*frame,
IsSpdy2() ? kV2FrameData : kV3FrameData,
@@ -2466,7 +2466,7 @@ TEST_P(SpdyFramerTest, ReadCompressedSynReplyHeaderBlock) {
headers["alpha"] = "beta";
headers["gamma"] = "delta";
SpdyFramer framer(spdy_version_);
- scoped_ptr<SpdySynReplyControlFrame> control_frame(
+ scoped_ptr<SpdyFrame> control_frame(
framer.CreateSynReply(1, // stream_id
CONTROL_FLAG_NONE,
true, // compress
@@ -2680,19 +2680,33 @@ TEST_P(SpdyFramerTest, DecompressCorruptHeaderBlock) {
TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) {
// Create a GoAway frame that has a few extra bytes at the end.
// We create enough overhead to overflow the framer's control frame buffer.
- size_t overhead = SpdyFramer::kControlFrameBufferSize;
+ ASSERT_GE(254u, SpdyFramer::kControlFrameBufferSize);
+ const unsigned char length = 1 + SpdyFramer::kControlFrameBufferSize;
+ const unsigned char kV2FrameData[] = {
+ 0x80, spdy_version_, 0x00, 0x07,
+ 0x00, 0x00, 0x00, length,
+ 0x00, 0x00, 0x00, 0x00,
+ };
+ const unsigned char kV3FrameData[] = {
+ 0x80, spdy_version_, 0x00, 0x07,
+ 0x00, 0x00, 0x00, length,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ };
SpdyFramer framer(spdy_version_);
- scoped_ptr<SpdyGoAwayControlFrame> goaway(framer.CreateGoAway(1, GOAWAY_OK));
- goaway->set_length(goaway->length() + overhead);
- string pad('A', overhead);
+ const size_t pad_length = length + SpdyFrame::kHeaderSize -
+ (IsSpdy2() ? sizeof(kV2FrameData) : sizeof(kV3FrameData));
+ string pad('A', pad_length);
TestSpdyVisitor visitor(spdy_version_);
- visitor.SimulateInFramer(
- reinterpret_cast<unsigned char*>(goaway->data()),
- goaway->length() - overhead + SpdyControlFrame::kHeaderSize);
+ if (IsSpdy2()) {
+ visitor.SimulateInFramer(kV2FrameData, sizeof(kV2FrameData));
+ } else {
+ visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData));
+ }
visitor.SimulateInFramer(
reinterpret_cast<const unsigned char*>(pad.c_str()),
- overhead);
+ pad.length());
EXPECT_EQ(1, visitor.error_count_); // This generated an error.
EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h
index e9faa24..a1a6815 100644
--- a/net/spdy/spdy_protocol.h
+++ b/net/spdy/spdy_protocol.h
@@ -523,12 +523,6 @@ struct SpdyCredentialControlFrameBlock : SpdyFrameBlock {
// for each certificate: unit32 certificate_len + certificate_data[i]
};
-// A GOAWAY Control Frame structure.
-struct SpdyGoAwayControlFrameBlock : SpdyFrameBlock {
- SpdyStreamId last_accepted_stream_id_;
- SpdyGoAwayStatus status_;
-};
-
// A HEADERS Control Frame structure.
struct SpdyHeadersControlFrameBlock : SpdyFrameBlock {
SpdyStreamId stream_id_;
@@ -1216,42 +1210,6 @@ class SpdyCredentialControlFrame : public SpdyControlFrame {
DISALLOW_COPY_AND_ASSIGN(SpdyCredentialControlFrame);
};
-class SpdyGoAwayControlFrame : public SpdyControlFrame {
- public:
- SpdyGoAwayControlFrame() : SpdyControlFrame(size()) {}
- SpdyGoAwayControlFrame(char* data, bool owns_buffer)
- : SpdyControlFrame(data, owns_buffer) {}
-
- SpdyStreamId last_accepted_stream_id() const {
- return ntohl(block()->last_accepted_stream_id_) & kStreamIdMask;
- }
-
- SpdyGoAwayStatus status() const {
- if (version() < 3) {
- LOG(DFATAL) << "Attempted to access status of SPDY 2 GOAWAY.";
- return GOAWAY_INVALID;
- } else {
- uint32 status = ntohl(block()->status_);
- if (status >= GOAWAY_NUM_STATUS_CODES) {
- return GOAWAY_INVALID;
- } else {
- return static_cast<SpdyGoAwayStatus>(status);
- }
- }
- }
-
- static size_t size() { return sizeof(SpdyGoAwayControlFrameBlock); }
-
- private:
- const struct SpdyGoAwayControlFrameBlock* block() const {
- return static_cast<SpdyGoAwayControlFrameBlock*>(frame_);
- }
- struct SpdyGoAwayControlFrameBlock* mutable_block() {
- return static_cast<SpdyGoAwayControlFrameBlock*>(frame_);
- }
- DISALLOW_COPY_AND_ASSIGN(SpdyGoAwayControlFrame);
-};
-
// A HEADERS frame.
class SpdyHeadersControlFrame : public SpdyControlFrame {
public:
diff --git a/net/spdy/spdy_protocol_test.cc b/net/spdy/spdy_protocol_test.cc
index 7fb9d2a..766d43e 100644
--- a/net/spdy/spdy_protocol_test.cc
+++ b/net/spdy/spdy_protocol_test.cc
@@ -48,7 +48,6 @@ TEST_P(SpdyProtocolTest, ProtocolConstants) {
EXPECT_EQ(16u, SpdyRstStreamControlFrame::size());
EXPECT_EQ(12u, SpdySettingsControlFrame::size());
EXPECT_EQ(12u, SpdyPingControlFrame::size());
- EXPECT_EQ(16u, SpdyGoAwayControlFrame::size());
EXPECT_EQ(12u, SpdyHeadersControlFrame::size());
EXPECT_EQ(16u, SpdyWindowUpdateControlFrame::size());
EXPECT_EQ(4u, sizeof(FlagsAndLength));
@@ -85,86 +84,6 @@ TEST_P(SpdyProtocolTest, DataFrameStructs) {
EXPECT_EQ(12345u, data_frame.stream_id());
}
-TEST_P(SpdyProtocolTest, ControlFrameStructs) {
- SpdyFramer framer(spdy_version_);
- SpdyHeaderBlock headers;
-
- const uint8 credential_slot = IsSpdy2() ? 0 : 5;
-
- scoped_ptr<SpdySynStreamControlFrame> syn_frame(framer.CreateSynStream(
- 123, 456, 2, credential_slot, CONTROL_FLAG_FIN, false, &headers));
- EXPECT_EQ(framer.protocol_version(), syn_frame->version());
- EXPECT_TRUE(syn_frame->is_control_frame());
- EXPECT_EQ(SYN_STREAM, syn_frame->type());
- EXPECT_EQ(123u, syn_frame->stream_id());
- EXPECT_EQ(456u, syn_frame->associated_stream_id());
- EXPECT_EQ(2u, syn_frame->priority());
- EXPECT_EQ(credential_slot, syn_frame->credential_slot());
- EXPECT_EQ(IsSpdy2() ? 2 : 4, syn_frame->header_block_len());
- EXPECT_EQ(1u, syn_frame->flags());
- syn_frame->set_associated_stream_id(999u);
- EXPECT_EQ(123u, syn_frame->stream_id());
- EXPECT_EQ(999u, syn_frame->associated_stream_id());
-
- scoped_ptr<SpdySynReplyControlFrame> syn_reply(
- framer.CreateSynReply(123, CONTROL_FLAG_NONE, false, &headers));
- EXPECT_EQ(framer.protocol_version(), syn_reply->version());
- EXPECT_TRUE(syn_reply->is_control_frame());
- EXPECT_EQ(SYN_REPLY, syn_reply->type());
- EXPECT_EQ(123u, syn_reply->stream_id());
- EXPECT_EQ(IsSpdy2() ? 2 : 4, syn_reply->header_block_len());
- EXPECT_EQ(0, syn_reply->flags());
-
- scoped_ptr<SpdyRstStreamControlFrame> rst_frame(
- framer.CreateRstStream(123, RST_STREAM_PROTOCOL_ERROR));
- EXPECT_EQ(framer.protocol_version(), rst_frame->version());
- EXPECT_TRUE(rst_frame->is_control_frame());
- EXPECT_EQ(RST_STREAM, rst_frame->type());
- EXPECT_EQ(123u, rst_frame->stream_id());
- EXPECT_EQ(RST_STREAM_PROTOCOL_ERROR, rst_frame->status());
- rst_frame->set_status(RST_STREAM_INVALID_STREAM);
- EXPECT_EQ(RST_STREAM_INVALID_STREAM, rst_frame->status());
- EXPECT_EQ(0, rst_frame->flags());
-
- const uint32 kUniqueId = 1234567u;
- const uint32 kUniqueId2 = 31415926u;
- scoped_ptr<SpdyPingControlFrame> ping_frame(
- framer.CreatePingFrame(kUniqueId));
- EXPECT_EQ(framer.protocol_version(), ping_frame->version());
- EXPECT_TRUE(ping_frame->is_control_frame());
- EXPECT_EQ(PING, ping_frame->type());
- EXPECT_EQ(kUniqueId, ping_frame->unique_id());
- ping_frame->set_unique_id(kUniqueId2);
- EXPECT_EQ(kUniqueId2, ping_frame->unique_id());
-
- scoped_ptr<SpdyGoAwayControlFrame> goaway_frame(
- framer.CreateGoAway(123, GOAWAY_INTERNAL_ERROR));
- EXPECT_EQ(framer.protocol_version(), goaway_frame->version());
- EXPECT_TRUE(goaway_frame->is_control_frame());
- EXPECT_EQ(GOAWAY, goaway_frame->type());
- EXPECT_EQ(123u, goaway_frame->last_accepted_stream_id());
- if (!IsSpdy2()) {
- EXPECT_EQ(GOAWAY_INTERNAL_ERROR, goaway_frame->status());
- }
-
- scoped_ptr<SpdyHeadersControlFrame> headers_frame(
- framer.CreateHeaders(123, CONTROL_FLAG_NONE, false, &headers));
- EXPECT_EQ(framer.protocol_version(), headers_frame->version());
- EXPECT_TRUE(headers_frame->is_control_frame());
- EXPECT_EQ(HEADERS, headers_frame->type());
- EXPECT_EQ(123u, headers_frame->stream_id());
- EXPECT_EQ(IsSpdy2() ? 2 : 4, headers_frame->header_block_len());
- EXPECT_EQ(0, headers_frame->flags());
-
- scoped_ptr<SpdyWindowUpdateControlFrame> window_update_frame(
- framer.CreateWindowUpdate(123, 456));
- EXPECT_EQ(framer.protocol_version(), window_update_frame->version());
- EXPECT_TRUE(window_update_frame->is_control_frame());
- EXPECT_EQ(WINDOW_UPDATE, window_update_frame->type());
- EXPECT_EQ(123u, window_update_frame->stream_id());
- EXPECT_EQ(456u, window_update_frame->delta_window_size());
-}
-
TEST_P(SpdyProtocolTest, TestDataFrame) {
SpdyDataFrame frame;
diff --git a/net/tools/flip_server/spdy_interface.cc b/net/tools/flip_server/spdy_interface.cc
index b112883..591bfa7 100644
--- a/net/tools/flip_server/spdy_interface.cc
+++ b/net/tools/flip_server/spdy_interface.cc
@@ -449,7 +449,7 @@ size_t SpdySM::SendSynReplyImpl(uint32 stream_id, const BalsaHeaders& headers) {
headers.response_reason_phrase().as_string();
block["version"] = headers.response_version().as_string();
- SpdySynReplyControlFrame* fsrcf = buffered_spdy_framer_->CreateSynReply(
+ SpdyFrame* fsrcf = buffered_spdy_framer_->CreateSynReply(
stream_id, CONTROL_FLAG_NONE, true, &block);
size_t df_size = fsrcf->length() + SpdyFrame::kHeaderSize;
EnqueueDataFrame(new SpdyFrameDataFrame(fsrcf));