The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Protocol::SPDY::Base - abstract support for the SPDY protocol

VERSION

version 0.999_002

DESCRIPTION

Provides the base class for client, server and generic (proxy/analysis) SPDY handling.

METHODS

new

Instantiates a new SPDY-handling object. Applies any attributes passed as named parameters.

sender_zlib

The compression instance used for sending data.

receiver_zlib

Compression instance used for receiving (decompressing) data.

request_close

Issue a close request by sending a GOAWAY message.

check_version

Called before we do anything with a control frame.

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

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

queue_frame

Requests sending the given $frame at the earliest opportunity.

on_read

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.

prioritise_incoming_frames

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.

dispatch_frame

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.

incoming_stream

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.

apply_settings

Applies the given settings to our internal state.

Note : Not yet implemented

extract_frame

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_frame

Parse a frame extracted by "extract_frame". Returns an appropriate subclass of Protocol::SPDY::Frame if this succeeded, dies if it fails.

goaway

Requests termination of the connection.

ping

Sends a ping request. We should get a PING packet back as a high-priority reply.

settings

Send settings to the remote.

credential

Sends credential information to the remote.

version

Returns the version supported by this instance. Currently, this is always 3.

last_stream_id

The ID for the last stream we created.

write

Calls the external code which is expected to handle writes.

create_stream

Instantiate a new stream, returning the Protocol::SPDY::Stream instance.

pending_send

Returns a count of the frames that are waiting to be sent.

has_stream

Returns true if we have a stream matching the ID on the provided Protocol::SPDY::Stream instance.

stream_by_id

Returns the Protocol::SPDY::Stream matching the given ID.

INHERITED METHODS

Mixin::Event::Dispatch

add_handler_for_event, clear_event_handlers, event_handlers, invoke_event, subscribe_to_event, unsubscribe_from_event

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

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