Before this commit it was not possible to override the the ContentType
and ETag properties.
Since these properties aren't directly read from the os.FileInfo
objects returned by the FileSystem it seems reasonable that the user
might have a different policy for computing them.
For instance the underlying FileSystem may already know the
ContentType or want to use an MD5 Hash for the ETag.
This commit introduces two new optional interfaces ETager and
ContentTyper which, when defined on the os.FileInfo objects
returned by the FileSystem methods, allows the user of this library to
override the ETag and ContentType generation.
Fixesgolang/go#22577
Change-Id: Ib42e126db3fcc0a93463e61db85fde59be85cca5
Reviewed-on: https://go-review.googlesource.com/109217
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
http.TimeFormat hard-codes GMT and is documented that:
> TimeFormat is the time format to use when generating times in HTTP
> headers. It is like time.RFC1123 but hard-codes GMT as the time
> zone. The time being formatted must be in UTC for Format to generate
> the correct format.
These two users weren't UTC-ifying the time.Time first.
Fixesgolang/go#25015
Change-Id: I82be01856260e363361137fd9651b1940f439f21
Reviewed-on: https://go-review.googlesource.com/113795
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Currently there is no way to pass request scoped information from
the handler to the FileSytem interface. This can be important
to pass credentials or timeout parameters to the FileSystem
operations. Pipe context through the request from
http.Request.Context(). With pre-go1.7 use context.Background().
Custom FileSystem implementations will need to change, but it will
only require a new argument in each of the FileSystem methods.
The change will be trivial to update to.
Fixesgolang/go#17658
Change-Id: I7491faf3467ad55db793a68081e074a9b3f9624d
Reviewed-on: https://go-review.googlesource.com/32421
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
In particular, the Property and DeadPropsHolder types need to refer to
the standard xml package, not the internal fork, to be usable by other
packages.
Inside the package, the XML marshaling and unmarshaling is still done by
the etc/internal/xml package, and will remain that way until
https://github.com/golang/go/issues/13400 is resolved.
Fixesgolang/go#15128.
Change-Id: Ie7e7927d8b30d97d10b1a4a654d774fdf3e7a1e3
Reviewed-on: https://go-review.googlesource.com/21635
Reviewed-by: Andrew Gerrand <adg@golang.org>
The Go 1.5 version of the standard library's encoding/xml package was
rolled back to the 1.4 behavior. See #11841
Change-Id: I5a5d6636b90b19d59dbcfdc44adf54b4f0b3ccb7
Reviewed-on: https://go-review.googlesource.com/12772
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The default webDAV client for windows explorer, Mini-Redirector,
apparently can not handle XML elements with a default namespace.
This change modifies the emitted XML so that elements are prefixed with
the D: namespace, defined as as "DAV:" in the multistatus tag.
Fixesgolang/go#11177
Change-Id: Ib323ca312fa10bd5aa6e6c61d90812d066543bac
Reviewed-on: https://go-review.googlesource.com/10942
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This makes properties consistent even after a COPY, MOVE or DELETE.
A follow-up CL will eliminate the concept of a configurable PropSystem
entirely.
See discussion at
https://groups.google.com/forum/#!topic/golang-dev/2_LiN6sf93A
Litmust test before/after:
<- summary for `props': of 30 tests run: 28 passed, 2 failed. 93.3%
<- summary for `props': of 30 tests run: 29 passed, 1 failed. 96.7%
Change-Id: I9bd09d9fb73e40f87306eaec2679945874af023d
Reviewed-on: https://go-review.googlesource.com/10241
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This CL adds support to store arbitrary WebDAV properties in the
in-memory property system reference implementation. It covers the
the majority of property related litmus test cases. However, this CL
does not add support for COPY/MOVE/DELETE requests to the PropSystem
interface or implementation; memory occupied by dead properties of
affected resources will not be released. I propose to first agree on
how to store and lock dead properties in this CL and add support for
COPY/MOVE/DELETE in a follow-up change.
Before: Coverage of litmus 'props' test suite
16 tests were skipped, 14 tests run. 10 passed, 4 failed. 71.4%
After: Coverage of litmus 'props' test suite
0 tests were skipped, 30 tests run. 28 passed, 2 failed. 93.3%
Change-Id: Ie9af665fc588332ed30c7de256f47f8405078db3
Reviewed-on: https://go-review.googlesource.com/9374
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This change adds ETag headers to GET/HEAD/POST and PUT responses. It does
not update the existing If-header request handling. The ETag header and
DAV property value can be overriden by implementing a custom property
system. A similar scheme is provided for Content-Type.
This CL makes net/webdav pass three more litmus ‘locks’ test cases
successfully.
Before: Summary for `locks': of 30 tests run: 27 passed, 3 failed. 90.0%
After: Summary for `locks': of 34 tests run: 30 passed, 4 failed. 88.2%
Change-Id: I5102b9ac18d20844deaaa630b62cc3611b3f0740
Reviewed-on: https://go-review.googlesource.com/4903
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This change adds support for PROPFIND requests to net/webdav.
It contains a proposed PropSystem interface and a preliminary
implementation of an in-memory property system. As discussed
with nigeltao, this is the first of approximately 4-5 CLs to
get property support in the net/webdav package.
Current coverage of litmus 'props' test suite:
16 tests were skipped, 14 tests run. 10 passed, 4 failed. 71.4%
Change-Id: I0bc5f375422137e911a2f6fb0e99c43a5a52d5ac
Reviewed-on: https://go-review.googlesource.com/3417
Reviewed-by: Nigel Tao <nigeltao@golang.org>