diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-03 07:31:26 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-03 07:31:26 +0000 |
commit | 0837bc6161b7698f9a0300f38717abdf3c6f86bc (patch) | |
tree | f226ea109ad15e89e710204befa7441d557fb225 /net/spdy/spdy_test_util_spdy3.h | |
parent | cf4b6d6d8a47f92b87674420c11f986239c51f99 (diff) | |
download | chromium_src-0837bc6161b7698f9a0300f38717abdf3c6f86bc.zip chromium_src-0837bc6161b7698f9a0300f38717abdf3c6f86bc.tar.gz chromium_src-0837bc6161b7698f9a0300f38717abdf3c6f86bc.tar.bz2 |
Add WriteHeaders interface to SpdySession and SpdyStream.
To support WebSocket over SPDY, SpdyStream should provide a interface to
send HEADERS control frames for SpdyWebSocketStream.
This is because WebSocket over SPDY requires to convert a WebSocket frame
into one HEADERS frame and subsequent DATA frame(s) in the spec.
See also http://goo.gl/mJCrx the spec draft 9, "Frame mapping" section.
BUG=42320
TEST=net_unittests
Review URL: https://chromiumcodereview.appspot.com/10810069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_test_util_spdy3.h')
-rw-r--r-- | net/spdy/spdy_test_util_spdy3.h | 158 |
1 files changed, 86 insertions, 72 deletions
diff --git a/net/spdy/spdy_test_util_spdy3.h b/net/spdy/spdy_test_util_spdy3.h index 6f0d388..0443ac6 100644 --- a/net/spdy/spdy_test_util_spdy3.h +++ b/net/spdy/spdy_test_util_spdy3.h @@ -123,31 +123,31 @@ int AppendToBuffer(int val, // |buffer| is the buffer we're filling in. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPacket(const SpdyHeaderInfo& header_info, - const char* const extra_headers[], - int extra_header_count, - const char* const tail[], - int tail_header_count); + const char* const extra_headers[], + int extra_header_count, + const char* const tail[], + int tail_header_count); // Construct a generic SpdyControlFrame. SpdyFrame* ConstructSpdyControlFrame(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority, - SpdyControlType type, - SpdyControlFlags flags, - const char* const* kHeaders, - int kHeadersSize); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority, + SpdyControlType type, + SpdyControlFlags flags, + const char* const* kHeaders, + int kHeadersSize); SpdyFrame* ConstructSpdyControlFrame(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority, - SpdyControlType type, - SpdyControlFlags flags, - const char* const* kHeaders, - int kHeadersSize, - int associated_stream_id); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority, + SpdyControlType type, + SpdyControlFlags flags, + const char* const* kHeaders, + int kHeadersSize, + int associated_stream_id); // Construct an expected SPDY reply string. // |extra_headers| are the extra header-value pairs, which typically @@ -167,8 +167,7 @@ SpdyFrame* ConstructSpdySettings(const SettingsMap& settings); // Construct an expected SPDY CREDENTIAL frame. // |credential| is the credential to send. // Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyCredential( - const SpdyCredential& credential); +SpdyFrame* ConstructSpdyCredential(const SpdyCredential& credential); // Construct a SPDY PING frame. // Returns the constructed frame. The caller takes ownership of the frame. @@ -180,13 +179,12 @@ SpdyFrame* ConstructSpdyGoAway(); // Construct a SPDY WINDOW_UPDATE frame. // Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyWindowUpdate(SpdyStreamId, - uint32 delta_window_size); +SpdyFrame* ConstructSpdyWindowUpdate(SpdyStreamId, uint32 delta_window_size); // Construct a SPDY RST_STREAM frame. // Returns the constructed frame. The caller takes ownership of the frame. SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, - SpdyStatusCodes status); + SpdyStatusCodes status); // Construct a single SPDY header entry, for validation. // |extra_headers| are the extra header-value pairs. @@ -205,19 +203,19 @@ int ConstructSpdyHeader(const char* const extra_headers[], // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGet(const char* const url, - bool compressed, - int stream_id, - RequestPriority request_priority); + bool compressed, + int stream_id, + RequestPriority request_priority); // Constructs a standard SPDY GET SYN packet, optionally compressed. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority); // Constructs a standard SPDY GET SYN packet, optionally compressed. // |extra_headers| are the extra header-value pairs, which typically @@ -225,52 +223,59 @@ SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], // the full url will be used instead of simply the path. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority, - bool direct); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority, + bool direct); // Constructs a standard SPDY SYN_STREAM frame for a CONNECT request. SpdyFrame* ConstructSpdyConnect(const char* const extra_headers[], - int extra_header_count, - int stream_id); + int extra_header_count, + int stream_id); + +// Constructs a standard SPDY SYN_STREAM frame for WebSocket over SPDY +// opening handshake. +SpdyFrame* ConstructSpdyWebSocket(int stream_id, + const char* path, + const char* host, + const char* origin); // Constructs a standard SPDY push SYN packet. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], - int extra_header_count, - int stream_id, - int associated_stream_id); + int extra_header_count, + int stream_id, + int associated_stream_id); SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], - int extra_header_count, - int stream_id, - int associated_stream_id, - const char* url); + int extra_header_count, + int stream_id, + int associated_stream_id, + const char* url); SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], - int extra_header_count, - int stream_id, - int associated_stream_id, - const char* url, - const char* status, - const char* location); + int extra_header_count, + int stream_id, + int associated_stream_id, + const char* url, + const char* status, + const char* location); SpdyFrame* ConstructSpdyPush(int stream_id, - int associated_stream_id, - const char* url); + int associated_stream_id, + const char* url); SpdyFrame* ConstructSpdyPushHeaders(int stream_id, - const char* const extra_headers[], - int extra_header_count); + const char* const extra_headers[], + int extra_header_count); // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], - int extra_header_count, - int stream_id); + int extra_header_count, + int stream_id); // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. // |extra_headers| are the extra header-value pairs, which typically @@ -278,6 +283,11 @@ SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); +// Constructs a standard SPDY SYN_REPLY packet to match the WebSocket over SPDY +// opening handshake. +// Returns a SpdyFrame. +SpdyFrame* ConstructSpdyWebSocketSynReply(int stream_id); + // Constructs a standard SPDY SYN_REPLY packet with an Internal Server // Error status code. // Returns a SpdyFrame. @@ -285,45 +295,49 @@ SpdyFrame* ConstructSpdySynReplyError(int stream_id); // Constructs a standard SPDY SYN_REPLY packet with the specified status code. // Returns a SpdyFrame. -SpdyFrame* ConstructSpdySynReplyError( - const char* const status, - const char* const* const extra_headers, - int extra_header_count, - int stream_id); +SpdyFrame* ConstructSpdySynReplyError(const char* const status, + const char* const* const extra_headers, + int extra_header_count, + int stream_id); // Constructs a standard SPDY POST SYN packet. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPost(int64 content_length, - const char* const extra_headers[], - int extra_header_count); + const char* const extra_headers[], + int extra_header_count); // Constructs a chunked transfer SPDY POST SYN packet. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructChunkedSpdyPost(const char* const extra_headers[], - int extra_header_count); + int extra_header_count); // Constructs a standard SPDY SYN_REPLY packet to match the SPDY POST. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], - int extra_header_count); + int extra_header_count); // Constructs a single SPDY data frame with the contents "hello!" SpdyFrame* ConstructSpdyBodyFrame(int stream_id, - bool fin); + bool fin); // Constructs a single SPDY data frame with the given content. SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, - uint32 len, bool fin); + uint32 len, bool fin); + +// Constructs a SPDY HEADERS frame for a WebSocket frame over SPDY. +SpdyFrame* ConstructSpdyWebSocketHeadersFrame(int stream_id, + const char* length, + bool fin); // Wraps |frame| in the payload of a data frame in stream |stream_id|. -SpdyFrame* ConstructWrappedSpdyFrame( - const scoped_ptr<SpdyFrame>& frame, int stream_id); +SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, + int stream_id); // Create an async MockWrite from the given SpdyFrame. MockWrite CreateMockWrite(const SpdyFrame& req); |