updated dependencies
This commit is contained in:
parent
088bd1f03e
commit
e95910d920
148 changed files with 18553 additions and 2442 deletions
3
vendor/golang.org/x/net/AUTHORS
generated
vendored
3
vendor/golang.org/x/net/AUTHORS
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
# This source code refers to The Go Authors for copyright purposes.
|
||||
# The master list of authors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/AUTHORS.
|
||||
3
vendor/golang.org/x/net/CONTRIBUTORS
generated
vendored
3
vendor/golang.org/x/net/CONTRIBUTORS
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
# This source code was written by the Go contributors.
|
||||
# The master list of contributors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/CONTRIBUTORS.
|
||||
7
vendor/golang.org/x/net/webdav/file.go
generated
vendored
7
vendor/golang.org/x/net/webdav/file.go
generated
vendored
|
|
@ -163,6 +163,7 @@ type memFS struct {
|
|||
// - "/", "foo", false
|
||||
// - "/foo/", "bar", false
|
||||
// - "/foo/bar/", "x", true
|
||||
//
|
||||
// The frag argument will be empty only if dir is the root node and the walk
|
||||
// ends at that root node.
|
||||
func (fs *memFS) walk(op, fullname string, f func(dir *memFSNode, frag string, final bool) error) error {
|
||||
|
|
@ -546,11 +547,11 @@ func (f *memFile) Seek(offset int64, whence int) (int64, error) {
|
|||
npos := f.pos
|
||||
// TODO: How to handle offsets greater than the size of system int?
|
||||
switch whence {
|
||||
case os.SEEK_SET:
|
||||
case io.SeekStart:
|
||||
npos = int(offset)
|
||||
case os.SEEK_CUR:
|
||||
case io.SeekCurrent:
|
||||
npos += int(offset)
|
||||
case os.SEEK_END:
|
||||
case io.SeekEnd:
|
||||
npos = len(f.n.data) + int(offset)
|
||||
default:
|
||||
npos = -1
|
||||
|
|
|
|||
48
vendor/golang.org/x/net/webdav/internal/xml/marshal.go
generated
vendored
48
vendor/golang.org/x/net/webdav/internal/xml/marshal.go
generated
vendored
|
|
@ -32,33 +32,33 @@ const (
|
|||
// elements containing the data.
|
||||
//
|
||||
// The name for the XML elements is taken from, in order of preference:
|
||||
// - the tag on the XMLName field, if the data is a struct
|
||||
// - the value of the XMLName field of type xml.Name
|
||||
// - the tag of the struct field used to obtain the data
|
||||
// - the name of the struct field used to obtain the data
|
||||
// - the name of the marshalled type
|
||||
// - the tag on the XMLName field, if the data is a struct
|
||||
// - the value of the XMLName field of type xml.Name
|
||||
// - the tag of the struct field used to obtain the data
|
||||
// - the name of the struct field used to obtain the data
|
||||
// - the name of the marshalled type
|
||||
//
|
||||
// The XML element for a struct contains marshalled elements for each of the
|
||||
// exported fields of the struct, with these exceptions:
|
||||
// - the XMLName field, described above, is omitted.
|
||||
// - a field with tag "-" is omitted.
|
||||
// - a field with tag "name,attr" becomes an attribute with
|
||||
// the given name in the XML element.
|
||||
// - a field with tag ",attr" becomes an attribute with the
|
||||
// field name in the XML element.
|
||||
// - a field with tag ",chardata" is written as character data,
|
||||
// not as an XML element.
|
||||
// - a field with tag ",innerxml" is written verbatim, not subject
|
||||
// to the usual marshalling procedure.
|
||||
// - a field with tag ",comment" is written as an XML comment, not
|
||||
// subject to the usual marshalling procedure. It must not contain
|
||||
// the "--" string within it.
|
||||
// - a field with a tag including the "omitempty" option is omitted
|
||||
// if the field value is empty. The empty values are false, 0, any
|
||||
// nil pointer or interface value, and any array, slice, map, or
|
||||
// string of length zero.
|
||||
// - an anonymous struct field is handled as if the fields of its
|
||||
// value were part of the outer struct.
|
||||
// - the XMLName field, described above, is omitted.
|
||||
// - a field with tag "-" is omitted.
|
||||
// - a field with tag "name,attr" becomes an attribute with
|
||||
// the given name in the XML element.
|
||||
// - a field with tag ",attr" becomes an attribute with the
|
||||
// field name in the XML element.
|
||||
// - a field with tag ",chardata" is written as character data,
|
||||
// not as an XML element.
|
||||
// - a field with tag ",innerxml" is written verbatim, not subject
|
||||
// to the usual marshalling procedure.
|
||||
// - a field with tag ",comment" is written as an XML comment, not
|
||||
// subject to the usual marshalling procedure. It must not contain
|
||||
// the "--" string within it.
|
||||
// - a field with a tag including the "omitempty" option is omitted
|
||||
// if the field value is empty. The empty values are false, 0, any
|
||||
// nil pointer or interface value, and any array, slice, map, or
|
||||
// string of length zero.
|
||||
// - an anonymous struct field is handled as if the fields of its
|
||||
// value were part of the outer struct.
|
||||
//
|
||||
// If a field uses a tag "a>b>c", then the element c will be nested inside
|
||||
// parent elements a and b. Fields that appear next to each other that name
|
||||
|
|
|
|||
81
vendor/golang.org/x/net/webdav/internal/xml/read.go
generated
vendored
81
vendor/golang.org/x/net/webdav/internal/xml/read.go
generated
vendored
|
|
@ -35,57 +35,57 @@ import (
|
|||
// In the rules, the tag of a field refers to the value associated with the
|
||||
// key 'xml' in the struct field's tag (see the example above).
|
||||
//
|
||||
// * If the struct has a field of type []byte or string with tag
|
||||
// ",innerxml", Unmarshal accumulates the raw XML nested inside the
|
||||
// element in that field. The rest of the rules still apply.
|
||||
// - If the struct has a field of type []byte or string with tag
|
||||
// ",innerxml", Unmarshal accumulates the raw XML nested inside the
|
||||
// element in that field. The rest of the rules still apply.
|
||||
//
|
||||
// * If the struct has a field named XMLName of type xml.Name,
|
||||
// Unmarshal records the element name in that field.
|
||||
// - If the struct has a field named XMLName of type xml.Name,
|
||||
// Unmarshal records the element name in that field.
|
||||
//
|
||||
// * If the XMLName field has an associated tag of the form
|
||||
// "name" or "namespace-URL name", the XML element must have
|
||||
// the given name (and, optionally, name space) or else Unmarshal
|
||||
// returns an error.
|
||||
// - If the XMLName field has an associated tag of the form
|
||||
// "name" or "namespace-URL name", the XML element must have
|
||||
// the given name (and, optionally, name space) or else Unmarshal
|
||||
// returns an error.
|
||||
//
|
||||
// * If the XML element has an attribute whose name matches a
|
||||
// struct field name with an associated tag containing ",attr" or
|
||||
// the explicit name in a struct field tag of the form "name,attr",
|
||||
// Unmarshal records the attribute value in that field.
|
||||
// - If the XML element has an attribute whose name matches a
|
||||
// struct field name with an associated tag containing ",attr" or
|
||||
// the explicit name in a struct field tag of the form "name,attr",
|
||||
// Unmarshal records the attribute value in that field.
|
||||
//
|
||||
// * If the XML element contains character data, that data is
|
||||
// accumulated in the first struct field that has tag ",chardata".
|
||||
// The struct field may have type []byte or string.
|
||||
// If there is no such field, the character data is discarded.
|
||||
// - If the XML element contains character data, that data is
|
||||
// accumulated in the first struct field that has tag ",chardata".
|
||||
// The struct field may have type []byte or string.
|
||||
// If there is no such field, the character data is discarded.
|
||||
//
|
||||
// * If the XML element contains comments, they are accumulated in
|
||||
// the first struct field that has tag ",comment". The struct
|
||||
// field may have type []byte or string. If there is no such
|
||||
// field, the comments are discarded.
|
||||
// - If the XML element contains comments, they are accumulated in
|
||||
// the first struct field that has tag ",comment". The struct
|
||||
// field may have type []byte or string. If there is no such
|
||||
// field, the comments are discarded.
|
||||
//
|
||||
// * If the XML element contains a sub-element whose name matches
|
||||
// the prefix of a tag formatted as "a" or "a>b>c", unmarshal
|
||||
// will descend into the XML structure looking for elements with the
|
||||
// given names, and will map the innermost elements to that struct
|
||||
// field. A tag starting with ">" is equivalent to one starting
|
||||
// with the field name followed by ">".
|
||||
// - If the XML element contains a sub-element whose name matches
|
||||
// the prefix of a tag formatted as "a" or "a>b>c", unmarshal
|
||||
// will descend into the XML structure looking for elements with the
|
||||
// given names, and will map the innermost elements to that struct
|
||||
// field. A tag starting with ">" is equivalent to one starting
|
||||
// with the field name followed by ">".
|
||||
//
|
||||
// * If the XML element contains a sub-element whose name matches
|
||||
// a struct field's XMLName tag and the struct field has no
|
||||
// explicit name tag as per the previous rule, unmarshal maps
|
||||
// the sub-element to that struct field.
|
||||
// - If the XML element contains a sub-element whose name matches
|
||||
// a struct field's XMLName tag and the struct field has no
|
||||
// explicit name tag as per the previous rule, unmarshal maps
|
||||
// the sub-element to that struct field.
|
||||
//
|
||||
// * If the XML element contains a sub-element whose name matches a
|
||||
// field without any mode flags (",attr", ",chardata", etc), Unmarshal
|
||||
// maps the sub-element to that struct field.
|
||||
// - If the XML element contains a sub-element whose name matches a
|
||||
// field without any mode flags (",attr", ",chardata", etc), Unmarshal
|
||||
// maps the sub-element to that struct field.
|
||||
//
|
||||
// * If the XML element contains a sub-element that hasn't matched any
|
||||
// of the above rules and the struct has a field with tag ",any",
|
||||
// unmarshal maps the sub-element to that struct field.
|
||||
// - If the XML element contains a sub-element that hasn't matched any
|
||||
// of the above rules and the struct has a field with tag ",any",
|
||||
// unmarshal maps the sub-element to that struct field.
|
||||
//
|
||||
// * An anonymous struct field is handled as if the fields of its
|
||||
// value were part of the outer struct.
|
||||
// - An anonymous struct field is handled as if the fields of its
|
||||
// value were part of the outer struct.
|
||||
//
|
||||
// * A struct field with tag "-" is never unmarshalled into.
|
||||
// - A struct field with tag "-" is never unmarshalled into.
|
||||
//
|
||||
// Unmarshal maps an XML element to a string or []byte by saving the
|
||||
// concatenation of that element's character data in the string or
|
||||
|
|
@ -110,7 +110,6 @@ import (
|
|||
//
|
||||
// Unmarshal maps an XML element to a pointer by setting the pointer
|
||||
// to a freshly allocated value and then mapping the element to that value.
|
||||
//
|
||||
func Unmarshal(data []byte, v interface{}) error {
|
||||
return NewDecoder(bytes.NewReader(data)).Decode(v)
|
||||
}
|
||||
|
|
|
|||
10
vendor/golang.org/x/net/webdav/prop.go
generated
vendored
10
vendor/golang.org/x/net/webdav/prop.go
generated
vendored
|
|
@ -162,7 +162,7 @@ var liveProps = map[xml.Name]struct {
|
|||
|
||||
// TODO(nigeltao) merge props and allprop?
|
||||
|
||||
// Props returns the status of the properties named pnames for resource name.
|
||||
// props returns the status of the properties named pnames for resource name.
|
||||
//
|
||||
// Each Propstat has a unique status and each property name will only be part
|
||||
// of one Propstat element.
|
||||
|
|
@ -213,7 +213,7 @@ func props(ctx context.Context, fs FileSystem, ls LockSystem, name string, pname
|
|||
return makePropstats(pstatOK, pstatNotFound), nil
|
||||
}
|
||||
|
||||
// Propnames returns the property names defined for resource name.
|
||||
// propnames returns the property names defined for resource name.
|
||||
func propnames(ctx context.Context, fs FileSystem, ls LockSystem, name string) ([]xml.Name, error) {
|
||||
f, err := fs.OpenFile(ctx, name, os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
|
|
@ -246,7 +246,7 @@ func propnames(ctx context.Context, fs FileSystem, ls LockSystem, name string) (
|
|||
return pnames, nil
|
||||
}
|
||||
|
||||
// Allprop returns the properties defined for resource name and the properties
|
||||
// allprop returns the properties defined for resource name and the properties
|
||||
// named in include.
|
||||
//
|
||||
// Note that RFC 4918 defines 'allprop' to return the DAV: properties defined
|
||||
|
|
@ -272,7 +272,7 @@ func allprop(ctx context.Context, fs FileSystem, ls LockSystem, name string, inc
|
|||
return props(ctx, fs, ls, name, pnames)
|
||||
}
|
||||
|
||||
// Patch patches the properties of resource name. The return values are
|
||||
// patch patches the properties of resource name. The return values are
|
||||
// constrained in the same manner as DeadPropsHolder.Patch.
|
||||
func patch(ctx context.Context, fs FileSystem, ls LockSystem, name string, patches []Proppatch) ([]Propstat, error) {
|
||||
conflict := false
|
||||
|
|
@ -425,7 +425,7 @@ func findContentType(ctx context.Context, fs FileSystem, ls LockSystem, name str
|
|||
}
|
||||
ctype = http.DetectContentType(buf[:n])
|
||||
// Rewind file.
|
||||
_, err = f.Seek(0, os.SEEK_SET)
|
||||
_, err = f.Seek(0, io.SeekStart)
|
||||
return ctype, err
|
||||
}
|
||||
|
||||
|
|
|
|||
44
vendor/golang.org/x/net/webdav/webdav.go
generated
vendored
44
vendor/golang.org/x/net/webdav/webdav.go
generated
vendored
|
|
@ -13,6 +13,7 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
|
@ -535,13 +536,14 @@ func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status
|
|||
|
||||
walkFn := func(reqPath string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
return handlePropfindError(err, info)
|
||||
}
|
||||
|
||||
var pstats []Propstat
|
||||
if pf.Propname != nil {
|
||||
pnames, err := propnames(ctx, h.FileSystem, h.LockSystem, reqPath)
|
||||
if err != nil {
|
||||
return err
|
||||
return handlePropfindError(err, info)
|
||||
}
|
||||
pstat := Propstat{Status: http.StatusOK}
|
||||
for _, xmlname := range pnames {
|
||||
|
|
@ -554,7 +556,7 @@ func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status
|
|||
pstats, err = props(ctx, h.FileSystem, h.LockSystem, reqPath, pf.Prop)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
return handlePropfindError(err, info)
|
||||
}
|
||||
href := path.Join(h.Prefix, reqPath)
|
||||
if href != "/" && info.IsDir() {
|
||||
|
|
@ -633,6 +635,33 @@ func makePropstatResponse(href string, pstats []Propstat) *response {
|
|||
return &resp
|
||||
}
|
||||
|
||||
func handlePropfindError(err error, info os.FileInfo) error {
|
||||
var skipResp error = nil
|
||||
if info != nil && info.IsDir() {
|
||||
skipResp = filepath.SkipDir
|
||||
}
|
||||
|
||||
if errors.Is(err, os.ErrPermission) {
|
||||
// If the server cannot recurse into a directory because it is not allowed,
|
||||
// then there is nothing more to say about it. Just skip sending anything.
|
||||
return skipResp
|
||||
}
|
||||
|
||||
if _, ok := err.(*os.PathError); ok {
|
||||
// If the file is just bad, it couldn't be a proper WebDAV resource. Skip it.
|
||||
return skipResp
|
||||
}
|
||||
|
||||
// We need to be careful with other errors: there is no way to abort the xml stream
|
||||
// part way through while returning a valid PROPFIND response. Returning only half
|
||||
// the data would be misleading, but so would be returning results tainted by errors.
|
||||
// The curent behaviour by returning an error here leads to the stream being aborted,
|
||||
// and the parent http server complaining about writing a spurious header. We should
|
||||
// consider further enhancing this error handling to more gracefully fail, or perhaps
|
||||
// buffer the entire response until we've walked the tree.
|
||||
return err
|
||||
}
|
||||
|
||||
const (
|
||||
infiniteDepth = -1
|
||||
invalidDepth = -2
|
||||
|
|
@ -642,10 +671,11 @@ const (
|
|||
// infiniteDepth. Parsing any other string returns invalidDepth.
|
||||
//
|
||||
// Different WebDAV methods have further constraints on valid depths:
|
||||
// - PROPFIND has no further restrictions, as per section 9.1.
|
||||
// - COPY accepts only "0" or "infinity", as per section 9.8.3.
|
||||
// - MOVE accepts only "infinity", as per section 9.9.2.
|
||||
// - LOCK accepts only "0" or "infinity", as per section 9.10.3.
|
||||
// - PROPFIND has no further restrictions, as per section 9.1.
|
||||
// - COPY accepts only "0" or "infinity", as per section 9.8.3.
|
||||
// - MOVE accepts only "infinity", as per section 9.9.2.
|
||||
// - LOCK accepts only "0" or "infinity", as per section 9.10.3.
|
||||
//
|
||||
// These constraints are enforced by the handleXxx methods.
|
||||
func parseDepth(s string) int {
|
||||
switch s {
|
||||
|
|
|
|||
2
vendor/golang.org/x/net/webdav/xml.go
generated
vendored
2
vendor/golang.org/x/net/webdav/xml.go
generated
vendored
|
|
@ -113,7 +113,7 @@ func escape(s string) string {
|
|||
return s
|
||||
}
|
||||
|
||||
// Next returns the next token, if any, in the XML stream of d.
|
||||
// next returns the next token, if any, in the XML stream of d.
|
||||
// RFC 4918 requires to ignore comments, processing instructions
|
||||
// and directives.
|
||||
// http://www.webdav.org/specs/rfc4918.html#property_values
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue