19 Commits

Author SHA1 Message Date
Dmitri Shuralyov
7c360367ab http2, webdav, websocket: fix %q verb uses with wrong type
Caught early by the improved vet check gated behind the 1.26 language
version combined with a tiplang builder that tests with 1.26 language
version.

Fixes golang/go#76574.
Fixes golang/go#76599.
Fixes golang/go#76547.

Change-Id: If8e2266013df0a39fc980a1e9287f8cb75949811
Cq-Include-Trybots: luci.golang.try:x_net-gotip-linux-amd64-tiplang
Reviewed-on: https://go-review.googlesource.com/c/net/+/725220
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-11-28 14:06:04 -08:00
Zeke Lu
45b2658723 all: fix go vet warnings
http2/h2c/h2c_test.go:27:19: golang.org/x/net/http2.Setting composite literal uses unkeyed fields
webdav/prop_test.go:152:5: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:153:5: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:191:23: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:202:23: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:217:23: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:227:23: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:241:23: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:251:23: encoding/xml.Name composite literal uses unkeyed fields
webdav/prop_test.go:496:23: encoding/xml.Name composite literal uses unkeyed fields
http2/transport_test.go:5310:5: call to (*T).Fatal from a non-test goroutine
http2/transport_test.go:5317:5: call to (*T).Fatal from a non-test goroutine
http2/transport_test.go:5660:3: unreachable code

Change-Id: I8dc72b976d05dc96ae18d73660c83fc9a5584ce1
GitHub-Last-Rev: a19dceaf92
GitHub-Pull-Request: golang/net#133
Reviewed-on: https://go-review.googlesource.com/c/net/+/406454
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-16 13:33:12 +00:00
Brad Fitzpatrick
04ba8c85dd webdav: remove Go 1.6 support, use std context
Fixes golang/go#21364

Change-Id: Ibfc6f5001d7038e4efd1f3fe8fc6d3fdded85551
Reviewed-on: https://go-review.googlesource.com/c/148438
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-08 05:43:10 +00:00
Nick Craig-Wood
8e0cdda24e webdav: allow the user to override the ETag and ContentType properties
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.

Fixes golang/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>
2018-05-21 20:18:18 +00:00
Brad Fitzpatrick
57065200b4 webdav: convert to UTC before using http.TimeFormat
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.

Fixes golang/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>
2018-05-19 12:25:54 +00:00
Daniel Theophanes
4bb47a1098 webdav: add Context argument to FileSystem interface
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.

Fixes golang/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>
2016-11-01 19:16:31 +00:00
H. İbrahim Güngör
30db96677b webdav: set 'getlastmodified' live property for directories
WebDAV clients can't sort folders by date because 'getlastmodified' live
property is not set.

Fixes golang/go#15334.

Change-Id: Ie56fcf8ae98173878e0972c0f9401151953334ff
Reviewed-on: https://go-review.googlesource.com/23422
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-05-27 00:43:53 +00:00
Nigel Tao
e45385e9b2 webdav: have the exported API use the standard library's xml.Name type.
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.

Fixes golang/go#15128.

Change-Id: Ie7e7927d8b30d97d10b1a4a654d774fdf3e7a1e3
Reviewed-on: https://go-review.googlesource.com/21635
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 03:40:12 +00:00
Nigel Tao
bcb71dd18f webdav: run "gofmt -s" to simplify some tests.
Change-Id: Ie7422dd04b4d7a14059e33ac19cb82691cff3d3f
Reviewed-on: https://go-review.googlesource.com/21632
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 02:09:49 +00:00
Yasuhiro Matsumoto
d75b190240 webdav: fix props for directory
Fixes golang/go#13126

- GET/HEAD/POST method should not allowed for directory
- Ignore EOFs while detecting the file.

Change-Id: I5ce345408a5ea4ec0dc993631122e6c79fc64398
Reviewed-on: https://go-review.googlesource.com/16799
Reviewed-by: Robert Stepanek <robert.stepanek@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-12-11 09:22:36 +00:00
Nigel Tao
3a29182c25 webdav: use an internal fork of encoding/xml.
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>
2015-07-29 00:36:53 +00:00
mpl
34ff4cd5e6 webdav: make it work for Mini-Redirector, emit namespace-prefixed XML.
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.

Fixes golang/go#11177

Change-Id: Ib323ca312fa10bd5aa6e6c61d90812d066543bac
Reviewed-on: https://go-review.googlesource.com/10942
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-23 04:55:59 +00:00
Robert Stepanek
84afb0af00 webdav: Advertise exclusive write locks in supportedlock property.
Change-Id: I843c13b5a2f8e58c555ec3be09ca1d2d855126c7
Reviewed-on: https://go-review.googlesource.com/10631
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-03 06:45:54 +00:00
Robert Stepanek
610bfeebc3 webdav: Simplify handling of Etag and Content-Type headers for GET, HEAD,
POST and PUT requests.

Change-Id: Id7b8a0aff7af1edefc45e2441565a2261f539895
Reviewed-on: https://go-review.googlesource.com/10395
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-05-28 03:34:21 +00:00
Nigel Tao
ad9eb3904a webdav: delete the PropSystem and MemPS types.
Change-Id: I569993723942f71599411a25ff31e97c1bc8875c
Reviewed-on: https://go-review.googlesource.com/10305
Reviewed-by: Robert Stepanek <robert.stepanek@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-05-22 07:40:10 +00:00
Nigel Tao
72bfdce472 webdav: make properties belong to the File(System), not a PropSystem.
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>
2015-05-20 07:01:24 +00:00
Robert Stepanek
a8c61998a5 webdav: Add PROPPATCH support to in-memory property system.
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>
2015-04-29 05:57:07 +00:00
Robert Stepanek
84ba27dd5b webdav: add support for (custom) ETags and Content-Type.
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>
2015-04-09 07:16:28 +00:00
Robert Stepanek
7dbad50ab5 webdav: define property system and implement PROPFIND.
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>
2015-03-20 03:46:21 +00:00