The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Protocol::SPDY - abstract support for the SPDY protocol

VERSION

version 0.001

DESCRIPTION

NOTE: This is a rewrite of the original Protocol::SPDY implementation, and as such is still very much in an early stage of development. Primary focus is on providing server-side SPDY implementation for use with browsers such as Chrome and Firefox (at the time of writing, the development track for Firefox11 has initial SPDY support).

Provides an implementation for the SPDY protocol at an abstract (in-memory buffer) level. This means that these modules aren't much use on their own, since they only deal with the abstract protocol. If you want to add SPDY client or server support to your code, you'll need a transport as well - try one of these yet-to-be-released modules:

Eventually POE or AnyEvent implementations may arrive if someone more familiar with those frameworks takes an interest. On the server side, it should be possible to incorporate this as a plugin for Plack/PSGI so that any PSGI-compatible web application can support SPDY requests.

For a simple blocking client and server implementation, see the examples/ directory.

IMPLEMENTATION CONSIDERATIONS

The information in http://www.chromium.org/spdy may be useful when implementing clients (browsers).

This abstract protocol class requires a transport implementation.

UPGRADING EXISTING HTTP OR HTTPS CONNECTIONS

You can inform a browser that SPDY is available through the Alternate-Protocol HTTP header:

 Alternate-Protocol: <port>:<protocol>

For example:

 Alternate-Protocol: 2443:spdy/2

This applies both to HTTP and HTTPS.

If the browser is already connected to the server using TLS, the TLS/NPN mechanism can be used to indicate that SPDY is available. Currently this requires openssl-1.1 or later, although the NPN extension should be simple enough to backport if needed (see http://www.ietf.org/id/draft-agl-tls-nextprotoneg-00.txt for details). Since the port is already connected, only the <protocol> part is required ('spdy/2' or 'spdy/3') when sending via TLS/NPN.

This information could also be provided via the Alternate-Protocol header:

 Alternate-Protocol: 2443:spdy/2,443:npn-spdy/2,443:npn-spdy/3

METHODS

request_close

If we want to close, send a GOAWAY message first

check_version

Called before we do anything with a control frame.

Returns true if it's supported, false if not.

check_stream_id

Check whether we have established this stream before allowing it to continue

Returns true if it's okay, false if not.

create_stream

Create a stream.

Returns the stream ID, or 0 if we can't create any more on this connection.

next_stream_id

Generate the next stream ID for this connection.

Returns the next available stream ID, or 0 if we're out of available streams

packet_syn_stream

Generate a SYN_STREAM packet.

Takes the following options:

packet_syn_reply

Generate a SYN_REPLY packet.

Takes the following options:

packet_rst_stream

Generate a RST_STREAM packet.

Takes the following options:

packet_settings

Generate a SETTINGS packet.

Takes the following options:

packet_noop

Generate a SYN_STREAM packet.

Takes the following options:

packet_ping

Generate a PING packet.

Takes the following options:

packet_goaway

Generate a GOAWAY packet.

Takes the following options:

packet_headers

Generate a HEADERS packet.

Takes the following options:

parse_request

Convert an incoming HTTP-over-SPDY packet into a data structure and send appropriate event(s).

packet_response

Generate a response packet.

COMPONENTS

Further documentation can be found in the following modules:

SEE ALSO

Since the protocol is still in flux, it may be advisable to keep an eye on http://www.chromium.org/spdy.

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2011-2012. Licensed under the same terms as Perl itself.