response

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const HttpVersion = "1.1"

Constant

View Source
const WSVersion = 13

Variables

View Source
var WSSalt []byte = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11")

Functions

This section is empty.

Types

type StatusCode

type StatusCode uint16

StatusCode maps the status codes (and description)

var BAD_REQUEST StatusCode = 400 // missing/malformed headers
var FORBIDDEN StatusCode = 403 // invalid origin policy, TLS required
var INTERNAL StatusCode = 500 // custom error
var NOT_FOUND StatusCode = 404 // unserved or invalid URI
var SWITCHING_PROTOCOLS StatusCode = 101 // handshake success
var UPGRADE_REQUIRED StatusCode = 426 // invalid WS version

func (StatusCode) Message

func (sc StatusCode) Message() string

type T

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

T represents an HTTP Upgrade Response

func (T) GetProtocol

func (r T) GetProtocol() []byte

GetProtocol returns the choosen protocol if set, else nil

func (T) GetStatusCode

func (r T) GetStatusCode() StatusCode

GetStatusCode returns the response status code

func (*T) ProcessKey

func (r *T) ProcessKey(k []byte)

ProcessKey processes the accept token according to the rfc from the Sec-WebSocket-Key

func (T) Send

func (r T) Send(w io.Writer) (int, error)

Send sends the response through an io.Writer typically a socket

func (*T) SetProtocol

func (r *T) SetProtocol(p []byte)

SetProtocols sets the protocols

func (*T) SetStatusCode

func (r *T) SetStatusCode(sc StatusCode)

SetStatusCode sets the status code

Jump to

Keyboard shortcuts

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