Protocol::SPDY::Base - abstract support for the SPDY protocol
version 1.001
Provides the base class for client, server and generic (proxy/analysis) SPDY handling.
Instantiates a new SPDY-handling object. Applies any attributes passed as named parameters.
The compression instance used for sending data.
Compression instance used for receiving (decompressing) data.
Issue a close request by sending a GOAWAY message.
Send back the list of settings we'd previously persisted.
Typically called immediately after establishing the connection.
Sends a SETTINGS frame generated from the key/value pairs passed to this method.
Example:
$spdy->send_settings( initial_window_size => 32768, max_concurrent_streams => 16, );
Called before we do anything with a control frame.
Returns true if it's supported, false if not.
Generate the next stream ID for this connection.
Returns the next available stream ID, or 0 if we're out of available streams
Requests sending the given $frame at the earliest opportunity.
$frame
This is the method that an external transport would call when it has some data received from the other side of the SPDY connection. It expects to be called with a scalar containing bytes which can be decoded as SPDY frames; any SSL/TLS decoding should happen before passing data to this method.
Will call "dispatch_frame" for any valid frames that can be extracted from the stream.
Given a list of Protocol::SPDY::Frame instances, returns them reordered so that higher-priority items such as PING are handled first.
Does not yet support stream priority.
Dispatches the given frame to appropriate handlers - this will be the matching Protocol::SPDY::Stream if one exists, or internal connection state handling for GOAWAY/SETTINGS frames.
Called when we receive a frame that's not been picked up by the usual handlers - could be a SYN_REPLY on a stream that we don't have, for example.
Called when a new SYN_STREAM frame is received.
Returns the Protocol::SPDY::Stream matching the stream_id for this frame (if it has one).
Will return undef if we have no stream yet or this frame does not have a stream_id.
Applies the given settings to our internal state.
Given a scalar reference to a byte buffer, this will extract the first frame if possible and return the bytes if it succeeded, undef if not. No frame validation is performed: the bytes are extracted based on the length information only.
Parse a frame extracted by "extract_frame". Returns an appropriate subclass of Protocol::SPDY::Frame if this succeeded, dies if it fails.
Requests termination of the connection.
Sends a ping request. We should get a PING packet back as a high-priority reply.
Send settings to the remote.
Sends credential information to the remote.
Returns the version supported by this instance. Currently, this is always 3.
The ID for the last stream we created.
Calls the external code which is expected to handle writes.
Instantiate a new stream, returning the Protocol::SPDY::Stream instance.
Returns a count of the frames that are waiting to be sent.
Returns true if we have a stream matching the ID on the provided Protocol::SPDY::Stream instance.
Returns the Protocol::SPDY::Stream matching the given ID.
The expected rate (kilobyte/sec) we can send data to the other side.
The rate (kilobyte/sec) we expect to be able to receive data from the other side.
Future representing the current batch of frames being processed. Used for deferring window updates.
The following events may be raised by this class - use "subscribe_to_event" in Mixin::Event::Dispatch to watch for them:
$spdy->subscribe_to_event( send_frame => sub { my ($ev, $frame) = @_; print "Send: $frame\n"; $ev->unsubscribe if $frame->type_name eq 'GOAWAY'; } );
Called with the Protocol::SPDY::Frame instance just before we attempt to send a frame to the other side.
Called with the Protocol::SPDY::Frame instance just before we attempt to process a frame received from the other side.
Called when we have received a PING request, just before we send back the reply.
Called after we have created a new stream in response to an incoming packet.
Called for each new SETTINGS entry received from the other side, just before we have applied the value locally.
add_handler_for_event, clear_event_handlers, event_handlers, invoke_event, subscribe_to_event, unsubscribe_from_event
Tom Molesworth <cpan@perlsite.co.uk>
Copyright Tom Molesworth 2011-2015. Licensed under the same terms as Perl itself.
To install Protocol::SPDY, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Protocol::SPDY
CPAN shell
perl -MCPAN -e shell install Protocol::SPDY
For more information on module installation, please visit the detailed CPAN module installation guide.