webdav

package module
v0.0.0-...-681b119 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

README

Notice

This project has been deprecated, instead it is recommended you use the better supported:

https://godoc.org/golang.org/x/net/webdav

This is a fork that has since been improved substantially.

Old README.md content

Implementation of a self-contained WebDAV server in Go. It supports most features of RFC 4918; except for shared locks.

Verified using the WebDAV litmus tests.

To discuss this project, please see the Google Group.

This is not an official Google product.

Documentation

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 (
	// ErrorNotYetImplemented is intended for use for code in progress.
	ErrorNotYetImplemented = Error{/* contains filtered or unexported fields */}
	ErrorBadPath           = Error{/* contains filtered or unexported fields */}
	ErrorNotFound          = Error{/* contains filtered or unexported fields */}
	ErrorConflict          = Error{/* contains filtered or unexported fields */}
	ErrorNotAllowed        = Error{/* contains filtered or unexported fields */}
	ErrorUnsupportedType   = Error{/* contains filtered or unexported fields */}
	ErrorIsDir             = Error{/* contains filtered or unexported fields */}
	ErrorIsNotDir          = Error{/* contains filtered or unexported fields */}
	ErrorMissingParent     = Error{/* contains filtered or unexported fields */}
	ErrorUnderrun          = Error{/* contains filtered or unexported fields */}
	ErrorBadHost           = Error{/* contains filtered or unexported fields */}
	ErrorBadDepth          = Error{/* contains filtered or unexported fields */}
	ErrorBadDest           = Error{/* contains filtered or unexported fields */}
	ErrorBadPropfind       = Error{/* contains filtered or unexported fields */}
	ErrorDestExists        = Error{/* contains filtered or unexported fields */}
	ErrorSameFile          = Error{/* contains filtered or unexported fields */}
	ErrorBadProppatch      = Error{/* contains filtered or unexported fields */}
	ErrorLocked            = Error{/* contains filtered or unexported fields */}
	ErrorBadLock           = Error{/* contains filtered or unexported fields */}
)

Error codes that are reportable from the API.

Functions

This section is empty.

Types

type CopyOptions

type CopyOptions struct {
	Overwrite, Move bool
	Depth           int
}

CopyOptions indicate options applicable to a copy operation.

type Error

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

Error is the common error type used for webdav methods.

func (Error) Error

func (e Error) Error() string

func (Error) HTTPCode

func (e Error) HTTPCode() int

HTTPCode gets the HTTP error code appropriate for the error.

func (Error) HTTPStatus

func (e Error) HTTPStatus() string

HTTPStatus gets the HTTP status text to use for the error.

func (Error) InternalCause

func (e Error) InternalCause() error

InternalCause gets the underlying cause of the error, should not generally be provided to the client.

func (Error) String

func (e Error) String() string

func (Error) WithCause

func (e Error) WithCause(cause error) Error

WithCause is used to chain a cause onto a reported HTTP error code.

type File

type File interface {
	GetPath() string
	IsDirectory() bool
	Stat() (FileInfo, error)
	Open() (FileHandle, error)
	Truncate() (FileHandle, error)
	PatchProp(set, remove map[string]string) error
	GetProp(k string) (string, bool)
}

File represents an abstract File (or directory)

type FileHandle

type FileHandle interface {
	io.ReadSeeker
	io.Closer
	io.Writer
}

FileHandle is an open reference to a file for writing or reading.

type FileInfo

type FileInfo struct {
	Created, LastModified time.Time
	Size                  int64
}

FileInfo represents all metadat about a File.

type FileSystem

type FileSystem interface {
	ForPath(p string) (Path, error)
	Dumpz()
}

FileSystem represents and abstract filesystem that can perform operations on paths.

type Path

type Path interface {
	String() string
	Parent() Path
	Lookup() (File, error)
	LookupSubtree(depth int) ([]File, error)
	Mkdir() (File, error)
	Create() (File, FileHandle, error)
	CopyTo(dst Path, opt CopyOptions) (bool, error)
	Remove() error
	RecursiveRemove() map[string]error
}

Path is a unique path in the filesystem.

type WebDAV

type WebDAV struct {
	Debug bool
	// contains filtered or unexported fields
}

WebDAV is a http.Handler implementation that implements the WebDAV protocol over an abstract FileSystem. Set the Debug field to true in order to enable both serialization and logging of all requests.

func NewWebDAV

func NewWebDAV(fs FileSystem) *WebDAV

NewWebDAV creates a WebDAV http.Handler wrapper around a given FileSystem.

func (*WebDAV) ServeHTTP

func (s *WebDAV) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Package cond is a parser for the If header expected of webdav, to produce condition objects to evaluate the header.
Package cond is a parser for the If header expected of webdav, to produce condition objects to evaluate the header.
Package memfs is an in-memory implementation of webdav.FileSystem.
Package memfs is an in-memory implementation of webdav.FileSystem.

Jump to

Keyboard shortcuts

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