http2interop

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

README

HTTP/2 Interop Tests

This is a suite of tests that check a server to see if it plays nicely with other HTTP/2 clients. To run, just type:

go test -spec :1234

Where ":1234" is the ip:port of a running server.

Documentation

Overview

http2interop document

Index

Constants

View Source
const (
	PING_ACK = 0x01
)
View Source
const (
	Preface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
)
View Source
const (
	SETTINGS_ACK = 1
)
View Source
const (
	SETTINGS_FLAG_ACK byte = 0x01
)

Variables

This section is empty.

Functions

func Report

func Report(t testing.TB)

When a test is skipped or fails, runtime.Goexit() is called which destroys the callstack. This means the name of the test case is lost, so we need to grab a copy of pc before.

Types

type CapConn

type CapConn struct {
	net.Conn
	Log func(args ...interface{})
}

CapConn captures connection traffic if Log is non-nil

func (*CapConn) Read

func (c *CapConn) Read(data []byte) (int, error)

func (*CapConn) Write

func (c *CapConn) Write(data []byte) (int, error)

type Frame

type Frame interface {
	GetHeader() *FrameHeader
	ParsePayload(io.Reader) error
	MarshalBinary() ([]byte, error)
}

type FrameHeader

type FrameHeader struct {
	Length   int
	Type     FrameType
	Flags    byte
	Reserved Reserved
	StreamID
}

func (*FrameHeader) MarshalBinary

func (fh *FrameHeader) MarshalBinary() ([]byte, error)

func (*FrameHeader) Parse

func (fh *FrameHeader) Parse(r io.Reader) error

func (*FrameHeader) UnmarshalBinary

func (fh *FrameHeader) UnmarshalBinary(b []byte) error

type FrameType

type FrameType byte
const (
	DataFrameType         FrameType = 0
	HeadersFrameType      FrameType = 1
	PriorityFrameType     FrameType = 2
	ResetStreamFrameType  FrameType = 3
	SettingsFrameType     FrameType = 4
	PushPromiseFrameType  FrameType = 5
	PingFrameType         FrameType = 6
	GoAwayFrameType       FrameType = 7
	WindowUpdateFrameType FrameType = 8
	ContinuationFrameType FrameType = 9

	// HTTP1FrameType is not a real type, but rather a convenient way to check if the response
	// is an http response.  The type of a frame header is the 4th byte, which in an http1
	// response will be "HTTP/1.1 200 OK" or something like that.  The character for "P" is 80.
	HTTP1FrameType FrameType = 80
)

Types

func (FrameType) String

func (ft FrameType) String() string

type GoAwayFrame

type GoAwayFrame struct {
	Header FrameHeader
	Reserved
	StreamID
	// TODO(carl-mastrangelo): make an enum out of this.
	Code uint32
	Data []byte
}

func (*GoAwayFrame) GetHeader

func (f *GoAwayFrame) GetHeader() *FrameHeader

func (*GoAwayFrame) MarshalBinary

func (f *GoAwayFrame) MarshalBinary() ([]byte, error)

func (*GoAwayFrame) MarshalPayload

func (f *GoAwayFrame) MarshalPayload() ([]byte, error)

func (*GoAwayFrame) ParsePayload

func (f *GoAwayFrame) ParsePayload(r io.Reader) error

func (*GoAwayFrame) UnmarshalPayload

func (f *GoAwayFrame) UnmarshalPayload(raw []byte) error

type HTTP1Frame

type HTTP1Frame struct {
	Header FrameHeader
	Data   []byte
}

HTTP1Frame is not a real frame, but rather a way to represent an http1.x response.

func (*HTTP1Frame) GetHeader

func (f *HTTP1Frame) GetHeader() *FrameHeader

func (*HTTP1Frame) MarshalBinary

func (f *HTTP1Frame) MarshalBinary() ([]byte, error)

func (*HTTP1Frame) MarshalPayload

func (f *HTTP1Frame) MarshalPayload() ([]byte, error)

func (*HTTP1Frame) ParsePayload

func (f *HTTP1Frame) ParsePayload(r io.Reader) error

func (*HTTP1Frame) String

func (f *HTTP1Frame) String() string

type HTTP2InteropCtx

type HTTP2InteropCtx struct {
	// Inputs
	ServerHost             string
	ServerPort             int
	UseTLS                 bool
	UseTestCa              bool
	ServerHostnameOverride string

	T *testing.T
	// contains filtered or unexported fields
}

type PingFrame

type PingFrame struct {
	Header FrameHeader
	Data   []byte
}

func (*PingFrame) GetHeader

func (f *PingFrame) GetHeader() *FrameHeader

func (*PingFrame) MarshalBinary

func (f *PingFrame) MarshalBinary() ([]byte, error)

func (*PingFrame) MarshalPayload

func (f *PingFrame) MarshalPayload() ([]byte, error)

func (*PingFrame) ParsePayload

func (f *PingFrame) ParsePayload(r io.Reader) error

func (*PingFrame) UnmarshalPayload

func (f *PingFrame) UnmarshalPayload(raw []byte) error

type Reserved

type Reserved bool

func (Reserved) String

func (r Reserved) String() string

type SettingsFrame

type SettingsFrame struct {
	Header FrameHeader
	Params []SettingsParameter
}

func (*SettingsFrame) GetHeader

func (f *SettingsFrame) GetHeader() *FrameHeader

func (*SettingsFrame) MarshalBinary

func (f *SettingsFrame) MarshalBinary() ([]byte, error)

func (*SettingsFrame) MarshalPayload

func (f *SettingsFrame) MarshalPayload() ([]byte, error)

func (*SettingsFrame) ParsePayload

func (f *SettingsFrame) ParsePayload(r io.Reader) error

func (*SettingsFrame) UnmarshalPayload

func (f *SettingsFrame) UnmarshalPayload(raw []byte) error

type SettingsIdentifier

type SettingsIdentifier uint16
const (
	SettingsHeaderTableSize      SettingsIdentifier = 1
	SettingsEnablePush           SettingsIdentifier = 2
	SettingsMaxConcurrentStreams SettingsIdentifier = 3
	SettingsInitialWindowSize    SettingsIdentifier = 4
	SettingsMaxFrameSize         SettingsIdentifier = 5
	SettingsMaxHeaderListSize    SettingsIdentifier = 6
)

func (SettingsIdentifier) String

func (si SettingsIdentifier) String() string

type SettingsParameter

type SettingsParameter struct {
	Identifier SettingsIdentifier
	Value      uint32
}

type StreamID

type StreamID int32

type UnknownFrame

type UnknownFrame struct {
	Header FrameHeader
	Data   []byte
}

func (*UnknownFrame) GetHeader

func (f *UnknownFrame) GetHeader() *FrameHeader

func (*UnknownFrame) MarshalBinary

func (f *UnknownFrame) MarshalBinary() ([]byte, error)

func (*UnknownFrame) MarshalPayload

func (f *UnknownFrame) MarshalPayload() ([]byte, error)

func (*UnknownFrame) ParsePayload

func (f *UnknownFrame) ParsePayload(r io.Reader) error

func (*UnknownFrame) UnmarshalPayload

func (f *UnknownFrame) UnmarshalPayload(raw []byte) error

Jump to

Keyboard shortcuts

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