spdy

package
v0.0.0-...-e758773 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2011 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeSynStream    ControlFrameType = 0x0001
	TypeSynReply                      = 0x0002
	TypeRstStream                     = 0x0003
	TypeSettings                      = 0x0004
	TypeNoop                          = 0x0005
	TypePing                          = 0x0006
	TypeGoAway                        = 0x0007
	TypeHeaders                       = 0x0008
	TypeWindowUpdate                  = 0x0009
)

Control frame type constants

View Source
const (
	ProtocolError      StatusCode = 1
	InvalidStream                 = 2
	RefusedStream                 = 3
	UnsupportedVersion            = 4
	Cancel                        = 5
	InternalError                 = 6
	FlowControlError              = 7
)
View Source
const (
	SettingsUploadBandwidth      SettingsId = 1
	SettingsDownloadBandwidth               = 2
	SettingsRoundTripTime                   = 3
	SettingsMaxConcurrentStreams            = 4
	SettingsCurrentCwnd                     = 5
)
View Source
const HeaderDictionary = "optionsgetheadpostputdeletetrace" +
	"acceptaccept-charsetaccept-encodingaccept-languageauthorizationexpectfromhost" +
	"if-modified-sinceif-matchif-none-matchif-rangeif-unmodifiedsince" +
	"max-forwardsproxy-authorizationrangerefererteuser-agent" +
	"100101200201202203204205206300301302303304305306307400401402403404405406407408409410411412413414415416417500501502503504505" +
	"accept-rangesageetaglocationproxy-authenticatepublicretry-after" +
	"servervarywarningwww-authenticateallowcontent-basecontent-encodingcache-control" +
	"connectiondatetrailertransfer-encodingupgradeviawarning" +
	"content-languagecontent-lengthcontent-locationcontent-md5content-rangecontent-typeetagexpireslast-modifiedset-cookie" +
	"MondayTuesdayWednesdayThursdayFridaySaturdaySunday" +
	"JanFebMarAprMayJunJulAugSepOctNovDec" +
	"chunkedtext/htmlimage/pngimage/jpgimage/gifapplication/xmlapplication/xhtmltext/plainpublicmax-age" +
	"charset=iso-8859-1utf-8gzipdeflateHTTP/1.1statusversionurl\x00"

HeaderDictionary is the dictionary sent to the zlib compressor/decompressor. Even though the specification states there is no null byte at the end, Chrome sends it.

View Source
const MaxDataLength = 1<<24 - 1

MaxDataLength is the maximum number of bytes that can be stored in one frame.

View Source
const Version = 2

Version is the protocol version number that this package implements.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlFlags

type ControlFlags uint8

ControlFlags are the flags that can be set on a control frame.

const (
	ControlFlagFin ControlFlags = 0x01
)

type ControlFrameHeader

type ControlFrameHeader struct {
	Flags ControlFlags
	// contains filtered or unexported fields
}

ControlFrameHeader contains all the fields in a control frame header, in its unpacked in-memory representation.

type ControlFrameType

type ControlFrameType uint16

ControlFrameType stores the type field in a control frame header.

type DataFlags

type DataFlags uint8

DataFlags are the flags that can be set on a data frame.

const (
	DataFlagFin        DataFlags = 0x01
	DataFlagCompressed           = 0x02
)

type DataFrame

type DataFrame struct {
	// Note, high bit is the "Control" bit. Should be 0 for data frames.
	StreamId uint32
	Flags    DataFlags
	Data     []byte
}

DataFrame is the unpacked, in-memory representation of a DATA frame.

type Frame

type Frame interface {
	// contains filtered or unexported methods
}

Frame is a single SPDY frame in its unpacked in-memory representation. Use Framer to read and write it.

type Framer

type Framer struct {
	// contains filtered or unexported fields
}

Framer handles serializing/deserializing SPDY frames, including compressing/ decompressing payloads.

func NewFramer

func NewFramer(w io.Writer, r io.Reader) (*Framer, os.Error)

NewFramer allocates a new Framer for a given SPDY connection, repesented by a io.Writer and io.Reader. Note that Framer will read and write individual fields from/to the Reader and Writer, so the caller should pass in an appropriately buffered implementation to optimize performance.

func (*Framer) ReadFrame

func (f *Framer) ReadFrame() (Frame, os.Error)

ReadFrame reads SPDY encoded data and returns a decompressed Frame.

func (*Framer) WriteFrame

func (f *Framer) WriteFrame(frame Frame) os.Error

WriteFrame writes a frame.

type FramerError

type FramerError int
const (
	Internal FramerError = iota
	InvalidControlFrame
	UnlowercasedHeaderName
	DuplicateHeaders
	UnknownFrameType
	InvalidDataFrame
)

func (FramerError) String

func (e FramerError) String() string

type GoAwayFrame

type GoAwayFrame struct {
	CFHeader         ControlFrameHeader
	LastGoodStreamId uint32
}

GoAwayFrame is the unpacked, in-memory representation of a GOAWAY frame.

type HeadersFrame

type HeadersFrame struct {
	CFHeader ControlFrameHeader
	StreamId uint32
	Headers  http.Header
}

HeadersFrame is the unpacked, in-memory representation of a HEADERS frame.

type NoopFrame

type NoopFrame struct {
	CFHeader ControlFrameHeader
}

NoopFrame is the unpacked, in-memory representation of a NOOP frame.

type PingFrame

type PingFrame struct {
	CFHeader ControlFrameHeader
	Id       uint32
}

PingFrame is the unpacked, in-memory representation of a PING frame.

type RstStreamFrame

type RstStreamFrame struct {
	CFHeader ControlFrameHeader
	StreamId uint32
	Status   StatusCode
}

RstStreamFrame is the unpacked, in-memory representation of a RST_STREAM frame.

type SettingsFlag

type SettingsFlag uint8

SettingsFlag represents a flag in a SETTINGS frame.

const (
	FlagSettingsPersistValue SettingsFlag = 0x1
	FlagSettingsPersisted                 = 0x2
)

type SettingsFlagIdValue

type SettingsFlagIdValue struct {
	Flag  SettingsFlag
	Id    SettingsId
	Value uint32
}

SettingsFlagIdValue is the unpacked, in-memory representation of the combined flag/id/value for a setting in a SETTINGS frame.

type SettingsFrame

type SettingsFrame struct {
	CFHeader     ControlFrameHeader
	FlagIdValues []SettingsFlagIdValue
}

SettingsFrame is the unpacked, in-memory representation of a SPDY SETTINGS frame.

type SettingsId

type SettingsId uint32

SettingsFlag represents the id of an id/value pair in a SETTINGS frame.

type StatusCode

type StatusCode uint32

StatusCode represents the status that led to a RST_STREAM

type SynReplyFrame

type SynReplyFrame struct {
	CFHeader ControlFrameHeader
	StreamId uint32
	Headers  http.Header
}

SynReplyFrame is the unpacked, in-memory representation of a SYN_REPLY frame.

type SynStreamFrame

type SynStreamFrame struct {
	CFHeader             ControlFrameHeader
	StreamId             uint32
	AssociatedToStreamId uint32
	// Note, only 2 highest bits currently used
	// Rest of Priority is unused.
	Priority uint16
	Headers  http.Header
}

SynStreamFrame is the unpacked, in-memory representation of a SYN_STREAM frame.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL