webdav

package
v0.0.0-...-65f388c Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2015 License: MIT, BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package webdav etc etc TODO.

Index

Constants

View Source
const (
	StatusMulti               = 207
	StatusUnprocessableEntity = 422
	StatusLocked              = 423
	StatusFailedDependency    = 424
	StatusInsufficientStorage = 507
)

http://www.webdav.org/specs/rfc4918.html#status.code.extensions.to.http11

Variables

View Source
var (
	ErrConfirmationFailed = errors.New("webdav: confirmation failed")
	ErrForbidden          = errors.New("webdav: forbidden")
	ErrNoSuchLock         = errors.New("webdav: no such lock")
)

Functions

func StatusText

func StatusText(code int) string

Types

type Condition

type Condition struct {
	Not   bool
	Token string
	ETag  string
}

Condition can match a WebDAV resource, based on a token or ETag. Exactly one of Token and ETag should be non-empty.

type Dir

type Dir string

A Dir implements FileSystem using the native file system restricted to a specific directory tree.

While the FileSystem.OpenFile method takes '/'-separated paths, a Dir's string value is a filename on the native file system, not a URL, so it is separated by filepath.Separator, which isn't necessarily '/'.

An empty Dir is treated as ".".

func (Dir) Mkdir

func (d Dir) Mkdir(name string, perm os.FileMode) error

func (Dir) OpenFile

func (d Dir) OpenFile(name string, flag int, perm os.FileMode) (File, error)

func (Dir) RemoveAll

func (d Dir) RemoveAll(name string) error

func (Dir) Stat

func (d Dir) Stat(name string) (os.FileInfo, error)

type File

type File interface {
	http.File
	io.Writer
}

A File is returned by a FileSystem's OpenFile method and can be served by a Handler.

type FileSystem

type FileSystem interface {
	Mkdir(name string, perm os.FileMode) error
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
	RemoveAll(name string) error
	Stat(name string) (os.FileInfo, error)
}

A FileSystem implements access to a collection of named files. The elements in a file path are separated by slash ('/', U+002F) characters, regardless of host operating system convention.

Each method has the same semantics as the os package's function of the same name.

type Handler

type Handler struct {
	// FileSystem is the virtual file system.
	FileSystem FileSystem
	// LockSystem is the lock management system.
	LockSystem LockSystem
	// PropSystem is an optional property management system. If non-nil, TODO.
	PropSystem PropSystem
	// Logger is an optional error logger. If non-nil, it will be called
	// whenever handling a http.Request results in an error.
	Logger func(*http.Request, error)
}

func (*Handler) ServeHTTP

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

type LockDetails

type LockDetails struct {
	Depth    int           // Negative means infinite depth.
	Duration time.Duration // Negative means unlimited duration.
	OwnerXML string        // Verbatim XML.
	Path     string
}

type LockSystem

type LockSystem interface {
	// TODO: comment that the conditions should be ANDed together.
	Confirm(path string, conditions ...Condition) (c io.Closer, err error)
	// TODO: comment that token should be an absolute URI as defined by RFC 3986,
	// Section 4.3. In particular, it should not contain whitespace.
	Create(path string, now time.Time, ld LockDetails) (token string, c io.Closer, err error)
	Refresh(token string, now time.Time, duration time.Duration) (ld LockDetails, c io.Closer, err error)
	Unlock(token string) error
}

type PropSystem

type PropSystem interface{}

TODO: define the PropSystem interface.

Jump to

Keyboard shortcuts

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