http

package
v0.0.0-...-75dd923 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"

TimeFormat is an example of the HTTP date format. It can be used in the ParseTime function.

Variables

This section is empty.

Functions

This section is empty.

Types

type Headers

type Headers map[string]string

Headers is string key value map of the HTTP headers

func ReadHeaders

func ReadHeaders(reader *bufio.Reader) (headers Headers, err error)

ReadHeaders will parse the HTTP headers in a HTTP message. The reader must have already read the HTTP status line prior to calling this function.

func (*Headers) CacheControl

func (headers *Headers) CacheControl() (cacheControl []string)

CacheControl parses the Cache-Control header

type Request

type Request struct {
	Method  string
	Path    string
	HTTPVer string
	Headers Headers
	Body    string
}

Request represents a HTTP request.

func NewRequest

func NewRequest(conn net.Conn) (req *Request, err error)

NewRequest returns a new Request created by reading the connection and parsing the HTTP request message.

func (*Request) String

func (req *Request) String() (str string)

type Response

type Response struct {
	StatusCode        int
	StatusDescription string
	Headers           Headers
	Body              string
	HTTPVer           string
}

Response represents a HTTP response.

func NewResponse

func NewResponse(conn net.Conn) (resp *Response, err error)

NewResponse returns a new Response created by reading the connection and parsing the HTTP response message.

func (*Response) String

func (resp *Response) String() (str string)

Jump to

Keyboard shortcuts

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