// Called when a HEADERS frame is received.
// Note that header block data is not included. See
// OnControlFrameHeaderData().
- virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) = 0;
+ virtual void OnHeaders(SpdyStreamId stream_id,
+ bool has_priority,
+ SpdyPriority priority,
+ bool fin,
+ bool end) = 0;
// Called when a WINDOW_UPDATE frame has been parsed.
virtual void OnWindowUpdate(SpdyStreamId stream_id,
base::StringPiece protocol_id,
base::StringPiece host,
base::StringPiece origin) {}
+
+ // Called when a PRIORITY frame is received.
+ virtual void OnPriority(SpdyStreamId stream_id,
+ SpdyStreamId parent_stream_id,
+ uint8 weight,
+ bool exclusive) {}
+
+ // Called when a frame type we don't recognize is received.
+ // Return true if this appears to be a valid extension frame, false otherwise.
+ // We distinguish between extension frames and nonsense by checking
+ // whether the stream id is valid.
+ virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) = 0;
};
// Optionally, and in addition to SpdyFramerVisitorInterface, a class supporting
SPDY_AUTO_RESET,
SPDY_READING_COMMON_HEADER,
SPDY_CONTROL_FRAME_PAYLOAD,
- SPDY_READ_PADDING_LENGTH,
+ SPDY_READ_DATA_FRAME_PADDING_LENGTH,
SPDY_CONSUME_PADDING,
SPDY_IGNORE_REMAINING_PAYLOAD,
SPDY_FORWARD_STREAM_FRAME,
// availability of an alternative service to the client.
SpdySerializedFrame* SerializeAltSvc(const SpdyAltSvcIR& altsvc);
+ // Serializes a PRIORITY frame. The PRIORITY frame advises a change in
+ // the relative priority of the given stream.
+ SpdySerializedFrame* SerializePriority(const SpdyPriorityIR& priority);
+
// Serialize a frame of unknown type.
SpdySerializedFrame* SerializeFrame(const SpdyFrameIR& frame);
UnclosedStreamDataCompressorsOneByteAtATime);
FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest,
UncompressLargerThanFrameBufferInitialSize);
+ FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest,
+ CreatePushPromiseThenContinuationUncompressed);
FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ReadLargeSettingsFrame);
FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest,
ReadLargeSettingsFrameInSmallChunks);
size_t ProcessControlFrameHeaderBlock(const char* data,
size_t len,
bool is_hpack_header_block);
- size_t ProcessFramePaddingLength(const char* data, size_t len);
+ size_t ProcessDataFramePaddingLength(const char* data, size_t len);
size_t ProcessFramePadding(const char* data, size_t len);
size_t ProcessDataFramePayload(const char* data, size_t len);
size_t ProcessGoAwayFramePayload(const char* data, size_t len);
void WritePayloadWithContinuation(SpdyFrameBuilder* builder,
const std::string& hpack_encoding,
SpdyStreamId stream_id,
- SpdyFrameType type);
+ SpdyFrameType type,
+ int padding_payload_len);
private:
// Deliver the given control frame's uncompressed headers block to the
// Set the error code and moves the framer into the error state.
void set_error(SpdyError error);
- // The maximum size of the control frames that we support.
- // This limit is arbitrary. We can enforce it here or at the application
- // layer. We chose the framing layer, but this can be changed (or removed)
- // if necessary later down the line.
- size_t GetControlFrameBufferMaxSize() const {
- // The theoretical maximum for SPDY3 and earlier is (2^24 - 1) +
- // 8, since the length field does not count the size of the
- // header.
- if (spdy_version_ == SPDY2) {
- return 64 * 1024;
- }
- if (spdy_version_ == SPDY3) {
- return 16 * 1024 * 1024;
- }
- // Absolute maximum size of HTTP2 frame payload (section 4.2 "Frame size").
- return (1<<14) - 1;
- }
-
// The size of the control frame buffer.
// Since this is only used for control frame headers, the maximum control
// frame header size (SYN_STREAM) is sufficient; all remaining control
// frame data is streamed to the visitor.
static const size_t kControlFrameBufferSize;
+ // The maximum size of the control frames that we support.
+ // This limit is arbitrary. We can enforce it here or at the application
+ // layer. We chose the framing layer, but this can be changed (or removed)
+ // if necessary later down the line.
+ static const size_t kMaxControlFrameSize;
+
SpdyState state_;
SpdyState previous_state_;
SpdyError error_code_;
// The length (in bytes) of the padding payload to be processed.
size_t remaining_padding_payload_length_;
- // The length (in bytes) of the padding length field to be processed.
- size_t remaining_padding_length_fields_;
-
// The number of bytes remaining to read from the current control frame's
// headers. Note that header data blocks (for control types that have them)
// are part of the frame's payload, and not the frame's headers.