fileserver

package
v0.0.0-...-cf0bdef Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrBadRequest fileServerErrorKind = iota
	ErrRedirect
	ErrFsOpen
	ErrFsStat
	ErrDirFound
)

Variables

This section is empty.

Functions

func ContainsDotDot

func ContainsDotDot(v string) bool

func HandleDirPrelude

func HandleDirPrelude(w http.ResponseWriter, r *http.Request, dirstat os.FileInfo) (finished bool)

func HttpFileServer

func HttpFileServer(root http.FileSystem) http.Handler

func New

func New(root http.FileSystem) mchain.Handler

func NewEx

func NewEx(root http.FileSystem, notFoundHandler mchain.Handler) mchain.Handler

func ServeFile

func ServeFile(w http.ResponseWriter, r *http.Request, name string) error

func ServeRequestPath

func ServeRequestPath(w http.ResponseWriter, r *http.Request, root http.FileSystem) error

Types

type Err

type Err struct {
	httperror.HttpErr
	Kind     fileServerErrorKind
	Pathname string
	Dirstat  os.FileInfo
}

type FileServer

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

func (*FileServer) ServeHTTP

func (f *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) error

type FileServerEx

type FileServerEx struct {
	FileServer
	RedirectsEnabled bool
	NotFoundHandler  mchain.Handler
}

func (*FileServerEx) ServeHTTP

func (f *FileServerEx) ServeHTTP(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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