madness

package
v0.0.0-...-2841839 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CookieInspectionHandler is an http.HandlerFunc that returns 400 if the ROUTEID cookie isn't set
	CookieInspectionHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		c, err := r.Cookie("ROUTEID")
		if err != nil || c.Value == "" {
			w.WriteHeader(http.StatusBadRequest)
			w.Write(gross)
			return
		}
		w.Write(ok)
	})

	// TestHandler is an http.HandlerFunc that quickly returns 200
	TestHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Write(ok)
	})
)

Functions

func ParamInspectionFormValueHandler

func ParamInspectionFormValueHandler(next http.Handler) http.Handler

ParamInspectionFormValueHandler uses the http.Request.FormValue facility to grab the ROUTEID off the paramlist. This is by far the fastest way to do this, but alters the body, rendering application-level checksums invalid, and breaking brittle destinations that make expectations about its condition.

func ParamInspectionURLQueryContainsHandler

func ParamInspectionURLQueryContainsHandler(next http.Handler) http.Handler

ParamInspectionURLQueryContainsHandler is a variation of ParamInspection_URLQuery_Handler, that first inspects the http.Request.URL.RawQuery string, to see if it Contains (or may contain) the ROUTEID, before decoding the Query, which is a very expensive operation.

func ParamInspectionURLQueryHandler

func ParamInspectionURLQueryHandler(next http.Handler) http.Handler

ParamInspectionURLQueryHandler uses the http.Request.URL.Query().Get facility to grab the ROUTEID off the paramlist. This is a very expensive operation regardless of whether the parameter exists or not.

func PassThroughHandler

func PassThroughHandler(next http.Handler) http.Handler

PassThroughHandler is the best case handler, for benchmark comparisons

Types

This section is empty.

Jump to

Keyboard shortcuts

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