summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_framer.h
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 22:04:03 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 22:04:03 +0000
commitd083585002893abaa6172c361aa04306a0e4d396 (patch)
tree75ff77ddf51d68d450ee0e7d56192409e44bcf97 /net/spdy/spdy_framer.h
parent95c97199c4406036b216d74e4ba3a5c57c0081a2 (diff)
downloadchromium_src-d083585002893abaa6172c361aa04306a0e4d396.zip
chromium_src-d083585002893abaa6172c361aa04306a0e4d396.tar.gz
chromium_src-d083585002893abaa6172c361aa04306a0e4d396.tar.bz2
Update server push to allow use of HEADERS frame.
- Sync'd server changes for SPDY protocol and framer. - Adds HEADERS support & smaller header frame support. - Changes field name from "path" to "url" for pushed streams. - Changes existing semantics in SpdyStream and SpdyHttpStream with how the OnResponseReceived callback works and with how headers are parsed to reflect multi-frame arrival of headers. Other changes: - Reworked the StaticSocketDataProvider interface slightly so that we can share code between tests using DelayedSocketData or DeterministicSocketData - Tidy up net_log for pushed streams with associated-stream id logging and format fixes for SPDY_STREAM. BUG=none TEST=spdy_framer_test,spdy_network_transaction_unittest(s) Review URL: http://codereview.chromium.org/5248001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68221 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_framer.h')
-rw-r--r--net/spdy/spdy_framer.h61
1 files changed, 42 insertions, 19 deletions
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
index 9b290cd..85805f3 100644
--- a/net/spdy/spdy_framer.h
+++ b/net/spdy/spdy_framer.h
@@ -157,9 +157,27 @@ class SpdyFramer {
bool compressed,
SpdyHeaderBlock* headers);
+ // Create a SpdySynReplyControlFrame.
+ // |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,
+ SpdyHeaderBlock* headers);
+
static SpdyRstStreamControlFrame* CreateRstStream(SpdyStreamId stream_id,
SpdyStatusCodes status);
+ // Creates an instance of SpdySettingsControlFrame. The SETTINGS frame is
+ // used to communicate name/value pairs relevant to the communication channel.
+ // TODO(mbelshe): add the name/value pairs!!
+ static SpdySettingsControlFrame* CreateSettings(const SpdySettings& values);
+
+ static SpdyControlFrame* CreateNopFrame();
+
// Creates an instance of SpdyGoAwayControlFrame. 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
@@ -167,32 +185,25 @@ class SpdyFramer {
static SpdyGoAwayControlFrame* CreateGoAway(
SpdyStreamId last_accepted_stream_id);
+ // Creates an instance of SpdyHeadersControlFrame. The HEADERS frame is used
+ // for sending additional headers outside of a SYN_STREAM/SYN_REPLY. The
+ // arguments are the same as for CreateSynReply.
+ SpdyHeadersControlFrame* CreateHeaders(SpdyStreamId stream_id,
+ SpdyControlFlags flags,
+ bool compressed,
+ SpdyHeaderBlock* headers);
+
// Creates an instance of SpdyWindowUpdateControlFrame. The WINDOW_UPDATE
// frame is used to implement per stream flow control in SPDY.
static SpdyWindowUpdateControlFrame* CreateWindowUpdate(
- SpdyStreamId stream_id, uint32 delta_window_size);
-
- // Creates an instance of SpdySettingsControlFrame. The SETTINGS frame is
- // used to communicate name/value pairs relevant to the communication channel.
- // TODO(mbelshe): add the name/value pairs!!
- static SpdySettingsControlFrame* CreateSettings(const SpdySettings& values);
+ SpdyStreamId stream_id,
+ uint32 delta_window_size);
// Given a SpdySettingsControlFrame, extract the settings.
// Returns true on successful parse, false otherwise.
static bool ParseSettings(const SpdySettingsControlFrame* frame,
SpdySettings* settings);
- // Create a SpdySynReplyControlFrame.
- // |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,
- SpdyHeaderBlock* headers);
-
// Create a data frame.
// |stream_id| is the stream for this frame
// |data| is the data to be included in the frame.
@@ -203,8 +214,6 @@ class SpdyFramer {
SpdyDataFrame* CreateDataFrame(SpdyStreamId stream_id, const char* data,
uint32 len, SpdyDataFlags flags);
- static SpdyControlFrame* CreateNopFrame();
-
// NOTES about frame compression.
// We want spdy to compress headers across the entire session. As long as
// the session is over TCP, frames are sent serially. The client & server
@@ -249,7 +258,11 @@ class SpdyFramer {
protected:
FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, DataCompression);
+ FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ExpandBuffer_HeapSmash);
+ FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, HugeHeaderBlock);
FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, UnclosedStreamDataCompressors);
+ FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest,
+ UncompressLargerThanFrameBufferInitialSize);
friend class net::HttpNetworkLayer; // This is temporary for the server.
friend class net::HttpNetworkTransactionTest;
friend class net::HttpProxyClientSocketPoolTest;
@@ -266,6 +279,16 @@ class SpdyFramer {
void set_enable_compression(bool value);
static void set_enable_compression_default(bool value);
+
+ // The initial size of the control frame buffer; this is used internally
+ // as we parse through control frames. (It is exposed here for unit test
+ // purposes.)
+ static size_t kControlFrameBufferInitialSize;
+
+ // The maximum size of the control frame buffer that we support.
+ // TODO(mbelshe): We should make this stream-based so there are no limits.
+ static size_t kControlFrameBufferMaxSize;
+
private:
typedef std::map<SpdyStreamId, z_stream*> CompressorMap;