stdhttp

package module
v0.1.32 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: MIT Imports: 28 Imported by: 20

README

Additional custom packages

Documentation

Index

Constants

View Source
const (
	RequestOptionGzip                = ".gzip"
	RequestOptionSkipTLSVerification = ".skip-tls-verification"
	RequestOptionBasicAuthUser       = ".user"
	RequestOptionBasicAuthPassword   = ".password"
)

options with names starting with "." are used as internal parameters and are not added to query parameters

View Source
const (
	// ContentTypeHTML --
	ContentTypeHTML = "html"
	// ContentTypeCSS --
	ContentTypeCSS = "css"
	// ContentTypeText --
	ContentTypeText = "text"
	// ContentTypeJSON --
	ContentTypeJSON = "json"
	// ContentTypeIcon --
	ContentTypeIcon = "ico"

	// MethodGET --
	MethodGET = "GET"
	// MethodPOST --
	MethodPOST = "POST"
	// MethodHEAD --
	MethodHEAD = "HEAD"
	// MethodPUT --
	MethodPUT = "PUT"
	// MethodDELETE --
	MethodDELETE = "DELETE"
	// MethodCONNECT --
	MethodCONNECT = "CONNECT"
	// MethodOPTIONS --
	MethodOPTIONS = "OPTIONS"
	// MethodTRACE --
	MethodTRACE = "TRACE"
	// MethodPATCH --
	MethodPATCH = "PATCH"
)

Variables

This section is empty.

Functions

func AddLogFilterForRequest added in v0.1.8

func AddLogFilterForRequest(exp string, replace string) error

AddLogFilterForRequest --

func CloneURLvalues

func CloneURLvalues(src url.Values) (dst url.Values)

CloneURLvalues --

func ContentHeader

func ContentHeader(contentType string) (string, error)

ContentHeader --

func Error

func Error(id uint64, answerSent bool, w http.ResponseWriter, httpCode int, message string, err error)

Error --

func ReadData

func ReadData(header http.Header, body io.ReadCloser) (bodyBuf *bytes.Buffer, code int, err error)

ReadData --

func ReadRequestBody

func ReadRequestBody(r *http.Request) (bodyBuf *bytes.Buffer, code int, err error)

ReadRequestBody --

func Request

func Request(method string, uri string, timeout int, opts misc.StringMap, data []byte) (*bytes.Buffer, error)

Request --

func RequestEx added in v0.1.12

func RequestEx(method string, uri string, timeout int, opts misc.StringMap, data []byte) (*bytes.Buffer, http.Header, error)

RequestEx -- Don't forget call bufpool.PutBuf(returned_buf)

func ReturnRefresh

func ReturnRefresh(id uint64, w http.ResponseWriter, r *http.Request, httpCode int, forceTo string, data []byte, err error)

ReturnRefresh --

func SendJSON

func SendJSON(w http.ResponseWriter, statusCode int, data interface{})

SendJSON --

func SetLogFilterForRequest added in v0.1.8

func SetLogFilterForRequest(f *misc.Replace)

SetLogFilterForRequest --

func SetMinSizeForGzip added in v0.1.7

func SetMinSizeForGzip(size int)

SetMinSizeForGzip --

func WriteContentHeader

func WriteContentHeader(w http.ResponseWriter, contentType string) error

WriteContentHeader --

func WriteReply

func WriteReply(w http.ResponseWriter, httpCode int, contentCode string, data []byte) (err error)

WriteReply --

Types

type BlackHole

type BlackHole struct {
}

BlackHole -- http.ResponseWriter implementation

func (*BlackHole) Header

func (bh *BlackHole) Header() http.Header

Header --

func (*BlackHole) Write

func (bh *BlackHole) Write(data []byte) (int, error)

Write --

func (*BlackHole) WriteHeader

func (bh *BlackHole) WriteHeader(statusCode int)

WriteHeader --

type ExtraInfoFunc

type ExtraInfoFunc func() interface{}

ExtraInfoFunc --

type ExtraRootItemFunc

type ExtraRootItemFunc func() []string

ExtraRootItemFunc --

type HTTP

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

HTTP --

func NewListener

func NewListener(listenerCfg *config.Listener, handler Handler) (*HTTP, error)

NewListener --

func (*HTTP) AddEndpointsInfo

func (h *HTTP) AddEndpointsInfo(list misc.StringMap)

AddEndpointsInfo --

func (*HTTP) CancelPathReplacing added in v0.1.29

func (h *HTTP) CancelPathReplacing(path string)

CancelPathReplacing --

func (*HTTP) File added in v0.1.25

func (h *HTTP) File(id uint64, path string, w http.ResponseWriter, r *http.Request) (processed bool)

File --

func (*HTTP) IsPathReplaced added in v0.1.29

func (h *HTTP) IsPathReplaced(path string) bool

IsPathReplaced --

func (*HTTP) MenuHighlight

func (h *HTTP) MenuHighlight() (open template.HTML, close template.HTML)

MenuHighlight --

func (*HTTP) RemoveStdPath added in v0.1.29

func (h *HTTP) RemoveStdPath(path string)

RemoveStdPath --

func (*HTTP) ServeHTTP

func (h *HTTP) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP --

func (*HTTP) SetExtraInfoFunc

func (h *HTTP) SetExtraInfoFunc(f ExtraInfoFunc)

SetExtraInfoFunc --

func (*HTTP) SetName

func (h *HTTP) SetName(name string, description string)

SetName --

func (*HTTP) SetRootItemsFunc

func (h *HTTP) SetRootItemsFunc(f ExtraRootItemFunc)

SetRootItemsFunc --

func (*HTTP) Start

func (h *HTTP) Start() error

Start --

func (*HTTP) Stop

func (h *HTTP) Stop() error

Stop --

type Handler

type Handler interface {
	Handler(id uint64, path string, w http.ResponseWriter, r *http.Request) bool
}

Handler --

Jump to

Keyboard shortcuts

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