request

package
v0.0.0-...-51310d3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Methods = [...][]byte{
	[]byte("GET"),
	[]byte("POST"),
	[]byte("PUT"),
	[]byte("DELETE"),
	[]byte("CONNECT"),
	[]byte("HEAD"),
	[]byte("OPTIONS"),
	[]byte("TRACE"),
	[]byte("PATCH"),
}

Methods are http methods from rfc. https://www.ietf.org/rfc/rfc2616.txt, http methods must be uppercase

Functions

func ParseStartLine

func ParseStartLine(line string) (r1, r2, r3 string, ok bool)

parseStartLine parses "GET /foo HTTP/1.1" OR "HTTP/1.1 200 OK" into its three parts.

func WriteHeaders

func WriteHeaders(buf *bytes.Buffer, header textproto.MIMEHeader)

func WriteStartLine

func WriteStartLine(buf *bytes.Buffer, s1, s2, s3 string)

Types

type Request

type Request struct {
	Method string
	Uri    string
	Proto  string
	Auth   string

	Target string // target host with port
	// contains filtered or unexported fields
}

func ParseRequest

func ParseRequest(r *bufio.Reader) (*Request, error)

func (*Request) Marshal

func (r *Request) Marshal() []byte

func (*Request) MarshalAbs

func (r *Request) MarshalAbs() []byte

Jump to

Keyboard shortcuts

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