h2spec

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2015 License: MIT Imports: 11 Imported by: 0

README

h2spec

h2spec is a conformance test tool for HTTP/2 server.
This tool supports draft-ietf-httpbis-http2-17.

Install

Go to the releases page, find the version you want, and download the zip file.

Build

  1. Make sure you have go 1.4 and set GOPATH appropriately
  2. Clone this repo and move to the cloned repo directory
  3. Run go get github.com/bradfitz/http2
  4. Run go build cmd/h2spec.go

Usage

$ h2spec --help
Usage: h2spec [OPTIONS]

Options:
  -p:     Target port. (Default: 80)
  -h:     Target host. (Default: 127.0.0.1)
  -t:     Connect over TLS. (Default: false)
  -k:     Don't verify server's certificate. (Default: false)
  -o:     Maximum time allowed for test. (Default: 2)
  -s:     Section number on which to run the test. (Example: -s 6.1 -s 6.2)
  --help: Display this help and exit.

Screenshot

Sceenshot

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCodeDefault http2.ErrCode = 0xff
View Source
var FlagDefault http2.Flags = 0x0
View Source
var TIMEOUT = errors.New("Timeout")

Functions

func Run

func Run(ctx *Context)

func TestConnectionError added in v0.0.5

func TestConnectionError(ctx *Context, http2Conn *Http2Conn, codes []http2.ErrCode) (expected []Result, actual Result)

func TestErrorCode added in v0.0.5

func TestErrorCode(code http2.ErrCode, expected []http2.ErrCode) bool

func TestStreamError added in v0.0.5

func TestStreamError(ctx *Context, http2Conn *Http2Conn, codes []http2.ErrCode) (expected []Result, actual Result)

Types

type Context

type Context struct {
	Port      int
	Host      string
	Tls       bool
	TlsConfig *tls.Config
	Sections  map[string]bool
	Timeout   time.Duration
	Settings  map[http2.SettingID]uint32
}

func (*Context) Authority

func (ctx *Context) Authority() string

func (*Context) GetRunMode added in v0.0.5

func (ctx *Context) GetRunMode(section string) RunMode

type Http2Conn

type Http2Conn struct {
	HpackEncoder   *hpack.Encoder
	HeaderWriteBuf bytes.Buffer
	// contains filtered or unexported fields
}

func CreateHttp2Conn

func CreateHttp2Conn(ctx *Context, sn bool) *Http2Conn

func (*Http2Conn) EncodeHeader added in v0.0.4

func (h2Conn *Http2Conn) EncodeHeader(header []hpack.HeaderField) []byte

EncodeHeader encodes header and returns encoded bytes. h2Conn retains encoding context and next call of EncodeHeader will be performed using the same encoding context.

func (*Http2Conn) ReadFrame added in v0.0.3

func (h2Conn *Http2Conn) ReadFrame(t time.Duration) (http2.Frame, error)

ReadFrame reads a complete HTTP/2 frame from underlying connection. This function blocks until a complete frame is received or timeout t is expired. The returned http2.Frame must not be used after next ReadFrame call.

type Result added in v0.0.5

type Result interface {
	String() string
}

type ResultConnectionClose added in v0.0.5

type ResultConnectionClose struct{}

func (*ResultConnectionClose) String added in v0.0.5

func (rcc *ResultConnectionClose) String() string

type ResultError added in v0.0.5

type ResultError struct {
	Error error
}

func (*ResultError) String added in v0.0.5

func (re *ResultError) String() string

type ResultFrame added in v0.0.5

type ResultFrame struct {
	Type  http2.FrameType
	Flags http2.Flags
	Code  http2.ErrCode
}

func (*ResultFrame) String added in v0.0.5

func (rf *ResultFrame) String() string

type ResultTestTimeout added in v0.0.5

type ResultTestTimeout struct{}

func (*ResultTestTimeout) String added in v0.0.5

func (ttr *ResultTestTimeout) String() string

type RunMode added in v0.0.5

type RunMode int
const (
	ModeAll       RunMode = 0
	ModeGroupOnly RunMode = 1
	ModeSkip      RunMode = 2
)

type TcpConn

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

func CreateTcpConn

func CreateTcpConn(ctx *Context) *TcpConn

type Test added in v0.0.5

type Test interface {
	Run(*Context, int)
}

type TestCase added in v0.0.5

type TestCase struct {
	Desc string
	Spec string
	// contains filtered or unexported fields
}

func NewTestCase added in v0.0.5

func NewTestCase(desc, spec string, handler func(*Context) ([]Result, Result)) *TestCase

func (*TestCase) HandleFunc added in v0.0.5

func (tc *TestCase) HandleFunc(handler func(*Context) ([]Result, Result))

func (*TestCase) PrintError added in v0.0.5

func (tc *TestCase) PrintError(expected []Result, actual Result, level int)

func (*TestCase) PrintResult added in v0.0.5

func (tc *TestCase) PrintResult(level int)

func (*TestCase) Run added in v0.0.5

func (tc *TestCase) Run(ctx *Context, level int)

type TestGroup added in v0.0.5

type TestGroup struct {
	Section string
	Name    string
	// contains filtered or unexported fields
}

func ConnectionErrorHandlingTestGroup added in v0.0.5

func ConnectionErrorHandlingTestGroup() *TestGroup

func ConnectionSpecificHeaderFieldsTestGroup added in v0.0.5

func ConnectionSpecificHeaderFieldsTestGroup() *TestGroup

func ContinuationTestGroup added in v0.0.5

func ContinuationTestGroup() *TestGroup

func DataTestGroup added in v0.0.5

func DataTestGroup() *TestGroup

func DefinedSettingsParametersTestGroup added in v0.0.5

func DefinedSettingsParametersTestGroup() *TestGroup

func ErrorHandlingTestGroup added in v0.0.5

func ErrorHandlingTestGroup() *TestGroup

func ExtendingHttp2TestGroup added in v0.0.5

func ExtendingHttp2TestGroup() *TestGroup

func FrameSizeTestGroup added in v0.0.5

func FrameSizeTestGroup() *TestGroup

func GoawayTestGroup added in v0.0.5

func GoawayTestGroup() *TestGroup

func HeaderCompressionAndDecompressionTestGroup added in v0.0.5

func HeaderCompressionAndDecompressionTestGroup() *TestGroup

func HeadersTestGroup added in v0.0.5

func HeadersTestGroup() *TestGroup

func Http2ConnectionPrefaceTestGroup added in v0.0.5

func Http2ConnectionPrefaceTestGroup() *TestGroup

func HttpHeaderFieldsTestGroup added in v0.0.5

func HttpHeaderFieldsTestGroup() *TestGroup

func HttpRequestResponseExchangeTestGroup added in v0.0.5

func HttpRequestResponseExchangeTestGroup() *TestGroup

func InitialFlowControlWindowSizeTestGroup added in v0.0.5

func InitialFlowControlWindowSizeTestGroup() *TestGroup

func MalformedRequestsAndResponsesTestGroup added in v0.0.5

func MalformedRequestsAndResponsesTestGroup() *TestGroup

func NewTestGroup added in v0.0.5

func NewTestGroup(section, name string) *TestGroup

func PingTestGroup added in v0.0.5

func PingTestGroup() *TestGroup

func PriorityTestGroup added in v0.0.5

func PriorityTestGroup() *TestGroup

func PseudoHeaderFieldsTestGroup added in v0.0.5

func PseudoHeaderFieldsTestGroup() *TestGroup

func RequestPseudoHeaderFieldsTestGroup added in v0.0.5

func RequestPseudoHeaderFieldsTestGroup() *TestGroup

func RstStreamTestGroup added in v0.0.5

func RstStreamTestGroup() *TestGroup

func ServerPushTestGroup added in v0.0.5

func ServerPushTestGroup() *TestGroup

func SettingsTestGroup added in v0.0.5

func SettingsTestGroup() *TestGroup

func StreamConcurrencyTestGroup added in v0.0.5

func StreamConcurrencyTestGroup() *TestGroup

func StreamIdentifiersTestGroup added in v0.0.5

func StreamIdentifiersTestGroup() *TestGroup

func StreamStatesTestGroup added in v0.0.5

func StreamStatesTestGroup() *TestGroup

func TheFlowControlWindowTestGroup added in v0.0.5

func TheFlowControlWindowTestGroup() *TestGroup

func WindowUpdateTestGroup added in v0.0.5

func WindowUpdateTestGroup() *TestGroup

func (*TestGroup) AddTestCase added in v0.0.5

func (tg *TestGroup) AddTestCase(testCase *TestCase)

func (*TestGroup) AddTestGroup added in v0.0.5

func (tg *TestGroup) AddTestGroup(testGroup *TestGroup)

func (*TestGroup) PrintFooter added in v0.0.5

func (tg *TestGroup) PrintFooter(level int)

func (*TestGroup) PrintHeader added in v0.0.5

func (tg *TestGroup) PrintHeader(level int)

func (*TestGroup) Run added in v0.0.5

func (tg *TestGroup) Run(ctx *Context, level int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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