import "code.pfad.fr/gopim/webdav/libdav"
func ContextWith(ctx context.Context, name property.Responder, resp func(p property.Responder) (interface{}, error)) context.Context
func ContextWithCurrentUserPrincipal(ctx context.Context, cup func(p property.Responder) (interface{}, error)) context.Context
func DecodeXMLRequest[T any](r *http.Request, decode func(http.Header, *xml.Decoder) (T, error)) (v T, err error)
decode may be called with an empty body
rfc4918#section-10.2 Depth Header
const ( // DepthZero indicates that the request applies only to the resource. DepthZero Depth = 0 // DepthOne indicates that the request applies to the resource and its // internal members only. DepthOne Depth = 1 // DepthInfinity indicates that the request applies to the resource and all // of its members. DepthInfinity Depth = -1 )
DecodeDepth decodes the Depth header.
String formats the depth.
type Get struct { Request *http.Request ResponseWriter http.ResponseWriter }
func (g Get) ServeContent(contentType string, etagQuoted string, modtime time.Time, content io.ReadSeeker)
ServeList serves an HTML list of the names. The list MUST be sorted.
if err is nil, the standard status text is used
type HandleWriter interface { Handler Delete(req Request) error // recursive delete // rfc4918#section-9.7 Put(req Request, header http.Header, body io.ReadCloser, ) (statusCode int, headers http.Header, err error) }
type Handler interface { Options(req Request) (caps []string, methods []string, err error) Get(req Request, get Get) error Propfind(req Request, propfind Propfind) ([]Response, error) Report(req Request, report Report) ([]Response, error) }
type MultiStatus struct { XMLName xml.Name `xml:"DAV: multistatus"` Responses []Response `xml:"response"` ResponseDescription string `xml:"responsedescription,omitempty"` SyncToken string `xml:"sync-token,omitempty"` }
https://tools.ietf.org/html/rfc4918#section-14.16
func NewMultiStatus(resps ...Response) MultiStatus
rfc4918#section-10.6 Overwrite Header
DecodeOverwrite decodes the Overwrite header.
String formats the overwrite.
type PrincipalHandler struct { StatusHandler AddressbookHomeSet string }
Options implements Handler.
Propfind implements Handler.
type PropStat struct { Prop PropsRequest Allprop bool Propname bool // Include indicates additional props when Allprop is set Include []xml.Name }
func (ps PropStat) Response(ctx context.Context, path string, props property.ResponseMap) Response
if props is nil a not-found (404) response will be returned
rfc4918#section-14.20 only Prop, Allprop XOR Propname will be set
func (pf Propfind) Response(ctx context.Context, path string, props property.ResponseMap) Response
type PropsRequest []struct { XMLName xml.Name SubProps []struct { XMLName xml.Name Name string `xml:"name,attr"` } `xml:",any"` }
func (pr PropsRequest) Names() []xml.Name
func (pr PropsRequest) SubnameAttr(parent, child xml.Name) []string
SubnameAttr return nil if the parent is not present, otherwise it might return an empty slice.
type Propstat struct { Prop []any `xml:"prop>any"` Status ResponseStatus `xml:"status"` Responsedescription string `xml:"responsedescription,omitempty"` Error any `xml:"error,omitempty"` }
https://tools.ietf.org/html/rfc4918#section-14.22
type Request struct { Context context.Context Segments []string SegmentTrailingSlash bool Resource Resource }
Segment returns the i-th element, accepting negative values (-1 to get the last element).
type Resource struct { Handler Handler Children map[string]Resource CatchAll *Resource IsLeaf bool // true if not a collection }
type Response struct { Href property.Href `xml:"href"` Propstats []Propstat `xml:"propstat,omitempty"` Responsedescription string `xml:"responsedescription,omitempty"` Status *ResponseStatus `xml:"status,omitempty"` Error any `xml:"error,omitempty"` Location *property.Href `xml:"location>href,omitempty"` }
https://tools.ietf.org/html/rfc4918#section-14.24
type ResponseStatus struct { Code int // will default to 200 if left empty Text string // will be the default http status text for the code if left empty }
rfc4918#section-14.28 rfc2616#section-6.1
func (s ResponseStatus) MarshalText() ([]byte, error)
func (s *ResponseStatus) UnmarshalText(b []byte) error
type StaticHandler struct { StatusHandler Caps []string Properties property.ResponseMap }
Options implements Handler.
Propfind implements Handler.
func (p StatusHandler) Delete(req Request) error
Delete implements HandleWriter.
func (p StatusHandler) Get(req Request, get Get) error
Get implements Handler.
Options implements Handler.
Propfind implements Handler.
func (p StatusHandler) Put(req Request, header http.Header, body io.ReadCloser) (statusCode int, headers http.Header, err error)
Put implements HandleWriter.
Report implements Handler.
error.go get.go headers.go propfind.go report.go request.go resource.go response.go
Path | Synopsis |
---|---|
internal |