request

package
v0.0.0-...-0d3f7e8 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRawHTTPRequest

func GetRawHTTPRequest(req Request) (rawRequest []byte)

Reconstruct the raw request content from a Request struct

Types

type Request

type Request struct {
	CommandLine string //GET / HTTTP/1.1
	Method      string
	Version     string
	Headers     http.Header
	Body        []byte
}

func (*Request) AddCookie

func (r *Request) AddCookie(c *http.Cookie)

From net http package (+ withdraw sanitization) AddCookie adds a cookie to the request. Per RFC 6265 section 5.4, AddCookie does not attach more than one Cookie header field. That means all cookies, if any, are written into the same line, separated by semicolon. AddCookie only sanitizes c's name and value, and does not sanitize a Cookie header already present in the request.

func (*Request) SetMethod

func (request *Request) SetMethod(nMethod string)

SetMethod: Change the method for the HTTP Request (modify first line of the raw request + request obect)

func (*Request) SetPath

func (request *Request) SetPath(path string)

SetPath: Change the path uri with the one provided for the HTTP Request (modify first line of the raw request)

Jump to

Keyboard shortcuts

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