simpwebserv

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 13 Imported by: 1

README

simpwebserv

一个给go的http服务端框架

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileOverSize = errors.New("File over size")

Functions

func DecodeGETRequest added in v1.1.0

func DecodeGETRequest(request *SimpwebservRequest) map[string]string

func DecodePOSTFormRequest added in v1.2.0

func DecodePOSTFormRequest(request *SimpwebservRequest) map[string]string

func RecvFile added in v1.2.0

func RecvFile(request *SimpwebservRequest, storePath string, name string, maxSize int) error

Types

type SimpwebservApp

type SimpwebservApp struct {
	Listener net.Listener
	UrlMap   SimpwebservUrlNode
}

func App

func App() SimpwebservApp

func (*SimpwebservApp) Register

func (app *SimpwebservApp) Register(function func(*SimpwebservRequest) *SimpwebservResponse, path string)

func (*SimpwebservApp) Run

func (app *SimpwebservApp) Run(host string, port uint16)

type SimpwebservRequest

type SimpwebservRequest struct {
	Method   string
	Path     string
	Protocol string
	Host     string
	Header   map[string]string
	Body     *bytes.Buffer
}

type SimpwebservResponse

type SimpwebservResponse struct {
	Protocol    string
	Code        string
	CodeName    string
	Header      map[string]string
	Body        *bytes.Buffer
	ToDoCommand string
}

func BuildBasicResponse

func BuildBasicResponse() *SimpwebservResponse

func BuildJumpResponse added in v1.1.0

func BuildJumpResponse(target string) *SimpwebservResponse

func BuildNotFoundResponse

func BuildNotFoundResponse() *SimpwebservResponse

func SendFile added in v1.2.0

func SendFile(request *SimpwebservRequest, contentType string, filePath string, fileName string) *SimpwebservResponse

func SendStaticFile added in v1.1.0

func SendStaticFile(path string, contentType string) *SimpwebservResponse

type SimpwebservUrlNode

type SimpwebservUrlNode struct {
	Name        string
	NextLayer   *list.List
	IncludeBack bool
	Function    func(*SimpwebservRequest) *SimpwebservResponse
}

Jump to

Keyboard shortcuts

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