97 Commits

Author SHA1 Message Date
cuishuang
51f657b16c webdav/internal/xml: use the built-in min function
Starting from Go 1.21, the min functions are built-in.

Therefore, we can remove the custom functions with the same name.

Change-Id: Ia13e609358e19cf3863edc0f5a34e737cdcc291f
Reviewed-on: https://go-review.googlesource.com/c/net/+/707555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-09-30 12:18:58 -07:00
Tobias Klauser
45432b5e4f internal/socket, webdav: use testing.T.TempDir
It's available since Go 1.15 and go.mod currently specifies Go 1.18.

Change-Id: Ia5ba22f5802f4af9fb6d3b6e7ee5a02ce3582e9a
Reviewed-on: https://go-review.googlesource.com/c/net/+/643595
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2025-01-21 14:35:12 -08:00
Damien Neil
c1f5833288 all: replace deprecated io/ioutil calls
The io/ioutil package's features were moved to
the io and os packages in Go 1.16.

x/net depends on Go 1.18. Drop ioutil calls,
so gopls doesn't warn about them.

Change-Id: Ibdb576d94f250808ae285aa142e2fd41e7e9afc9
Reviewed-on: https://go-review.googlesource.com/c/net/+/586244
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-21 19:59:00 +00:00
vvatanabe
ac99879962 webdav: return 409 for PUT without parent collection
Aligning with the WebDAV RFC specification,
changes the server response for PUT operations that would
create a resource without an existing parent collection
from HTTP 404 Not Found to HTTP 409 Conflict.

RFC RFC4918, section 9.7.1

Fixes golang/go#67150

Change-Id: I5ce6c5ea147a6a450ef5ae2e0077eb0dce409743
Reviewed-on: https://go-review.googlesource.com/c/net/+/583055
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-10 17:25:32 +00:00
Dmitri Shuralyov
d23d9bc549 all: update go directive to 1.18
Done with:

go get go@1.18
go mod tidy
go fix ./...

Using go1.21.3.

With a manual change to keep golang.org/x/net/context testing itself,
not context in the standard library.

For golang/go#60268.

Change-Id: I00682bf7cf1e3ba4370e2a3e7f63dc245b294a36
Reviewed-on: https://go-review.googlesource.com/c/net/+/534241
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2023-10-11 21:58:12 +00:00
cui fliter
d28c0b1743 all: fix some comments
Change-Id: I005e210f0ae030c507b4bfd1548c5a885df4c6b9
Reviewed-on: https://go-review.googlesource.com/c/net/+/493155
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-05-10 21:21:25 +00:00
Oleksandr Redko
7e3c19ca52 all: correct typos in comments
Change-Id: Idc75240e5546be2f2b091878910339b4967c93c7
GitHub-Last-Rev: c78560c06f
GitHub-Pull-Request: golang/net#166
Reviewed-on: https://go-review.googlesource.com/c/net/+/465715
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-02-07 17:08:46 +00:00
Kyle Larose
f15817d10f webdav: ignore path and perm errors in PROPFIND
PROPFIND can walk through directories, retrieving information about
each file. Unfortunately, the filesystem may deny access to the WebDAV
server for various reasons, such as the file truly not being readable
(e.g. a broken symlink), or because the server does not have permission
to read the file. PROPFIND should ignore these.

The current behaviour of the WebDAV server when encountering such issues
is to immediately stop its walk, and output an http 500. This leads to
poor behaviour with the builtin golang server, since the walk has likely
already written out its status header as part of serving the previously
walked files' properties. The server closes the response, also emitting
an error log.

While the error log is noisy, the closed response is truly an issue: the
xml returned to the client is invalid, which means that the response is
useless. It is not unreasonable to expect that a directory shared using
WebDAV has files which cannot be read for the reasons given above. The
shared directory becomes useless with the current behavior.

Rather than making directories with unreadable files useless, skip over
anything that is bad. A more nuanced solution to this problem could
likely involve indicating that the requested properties have problems,
or buffering the response prior to returning the failure. However, this
change is simple and a move in the right direction.

Fixes golang/go#16195
Fixes golang/go#43782

Change-Id: I065e4c90f7ef797709e5e81e7318c3eafae6db71
GitHub-Last-Rev: d56917e028
GitHub-Pull-Request: golang/net#91
Reviewed-on: https://go-review.googlesource.com/c/net/+/285752
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) <nigeltao@google.com>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Matthew Holt <matthew.holt@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-10-14 08:14:12 +00:00
cui fliter
0b7e1fb9d4 all: fix a few function names on comments
Change-Id: I6c853dd402d296701e38289bbc418730b068dde8
Reviewed-on: https://go-review.googlesource.com/c/net/+/441716
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-10-12 13:50:44 +00:00
cui fliter
8be639271d webdav: replace os.SEEK_XXX with io.SeekXXX
Change-Id: I304410ad143377d48bd6eafcbf2413dcfc4e70a2
GitHub-Last-Rev: 0136a8a0c9
GitHub-Pull-Request: golang/net#151
Reviewed-on: https://go-review.googlesource.com/c/net/+/432257
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-23 20:38:11 +00: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
Russ Cox
290c469a71 all: gofmt
Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: Iae68a9cd600060577271575e893ecb23bed1e509
Reviewed-on: https://go-review.googlesource.com/c/net/+/399599
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-12 02:06:05 +00:00
Russ Cox
5f55cee0dc all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I5b2b7d93424e828a3c5f76ae3f30ab825aca388e
Reviewed-on: https://go-review.googlesource.com/c/net/+/294371
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-20 03:31:24 +00:00
billofarrell
146b70c837 all: add support for zos/s390x
This adds net support for zos/s390x. These changes should not affect other platforms.

Fixes golang/go#42130

Change-Id: Ia7faa29de76b7c5713120657b296106c2e27bfd2
Reviewed-on: https://go-review.googlesource.com/c/net/+/264028
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-10-26 09:15:29 +00:00
Brad Fitzpatrick
a91f0712d1 icmp, webdav/internal/xml: avoid string(int)
Updates golang/go#32479

Change-Id: Ife0c3a2f10afb676af5f2110a9681216122c8808
Reviewed-on: https://go-review.googlesource.com/c/net/+/233900
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-05-13 18:57:01 +00:00
Alexandr Mayorskiy
c0dbc17a35 webdav: allow empty host in move
interpret empty host as current

Change-Id: I70be8aa33c0e501df22a8ad17b7b430620d45da6
GitHub-Last-Rev: 28224d33df
GitHub-Pull-Request: golang/net#44
Reviewed-on: https://go-review.googlesource.com/c/net/+/181698
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-09 16:08:50 +00:00
Lars Lehtonen
c7154b74f1 webdav: fix dropped test error
Picks up a dropped error in TestMemLSConfirm().

Change-Id: Idfbb0fc37dcbec55b0ec6343221dcd9310f474b8
Reviewed-on: https://go-review.googlesource.com/c/net/+/206218
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-08 22:53:01 +00:00
Mykhailo Lesyk
1492cefac7 webdav: remove redundant trailing slash for root directory
Fixes golang/go#31983

Change-Id: I9925f392ea98cd6618551e936e1dbd5a2a9324c9
GitHub-Last-Rev: dba5c6876c
GitHub-Pull-Request: golang/net#42
Reviewed-on: https://go-review.googlesource.com/c/net/+/176737
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-06-06 17:38:56 +00:00
Mickael KERJEAN
c95aed5357 webdav: add trailing slash on directories
Fixes golang/go#29858

Change-Id: I7bd8357a7def7daab1fd6357a888ff4e676a1bee
GitHub-Last-Rev: a6dc776fa3
GitHub-Pull-Request: golang/net#32
Reviewed-on: https://go-review.googlesource.com/c/163863
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 16:05:52 +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
namusyaka
8351a756f3 all: fix article typos
a -> an

Change-Id: I7d0413396e51f16e0a83732a07a5536548e03506
Reviewed-on: https://go-review.googlesource.com/63992
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-15 14:21:06 +00:00
Dmitri Shuralyov
357296a763 all: single space after period
The tree's pretty inconsistent about single space vs double space
after a period in documentation. Make it consistently a single space,
per earlier decisions, and changes in go repository. This means
contributors won't be confused by misleading precedence.

This CL was generated with:

	perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')

on top of copyright headers change in https://golang.org/cl/32878.

Follows https://golang.org/cl/20022.

Change-Id: I821e4a300122b4668aa31e12eaa914db615e5369
Reviewed-on: https://go-review.googlesource.com/32879
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-01 21:02:21 +00:00
Mikio Hara
5bc3a08dc8 webdav: gofmt -w -s
Change-Id: I383c170b38cf2b787c29127efe2d3b0587e6ceec
Reviewed-on: https://go-review.googlesource.com/32138
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-15 03:56:16 +00:00
Dmitri Shuralyov
5d997795f7 all: make copyright headers consistent with one space after period
Go policy has been single space after periods in comments for some time.

The copyright header template at:

	https://golang.org/doc/contribute.html#copyright

also uses a single space.

Make them all consistent.

This CL was generated with:

	perl -i -npe 's,^(// Copyright [0-9]+ The Go Authors\.)  (All rights reserved\.)$,$1 $2,' $(git grep -l -E '^// Copyright [0-9]+ The Go Authors\.  All rights reserved\.$')

Follows https://golang.org/cl/20111.

Change-Id: I66671dddf821f5dc027bc254e0196b3e3a2bdf3b
Reviewed-on: https://go-review.googlesource.com/32878
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-07 23:52:11 +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
Brad Fitzpatrick
d6520b84c8 webdav: fix recently-broken tests
The net/http package is now better at HTTP redirects, but that broke
these tests which were trying to test the WebDAV server handler's
behavior for a single roundtrip but were accidentally using the HTTP
client (which does redirects) instead.

Use the http.Transport which only does a single HTTP roundtrip.

Change-Id: I8a0cfe2f841effc2f50c26f90c140e94e256a0ac
Reviewed-on: https://go-review.googlesource.com/32413
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-30 17:52:45 +00:00
Nigel Tao
3fe3024eef webdav: have escapeXML perform fewer allocations.
escapeXML was introduced in the previous commit:
https://go-review.googlesource.com/29297

Change-Id: I7d0c982049e495b312b1b8d28ba794444dd605d4
Reviewed-on: https://go-review.googlesource.com/32370
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-29 05:42:29 +00:00
Luka Zakrajšek
f11d7120b1 webdav: escape displayname
Displayname WebDAV property should be XML escaped. With current
implementation a file with name '<.txt' would make the XML
invalid.

Fixes golang/go#17158

Change-Id: Ib3b5376094edc957ed15adf511bd1050ea13d27e
Reviewed-on: https://go-review.googlesource.com/29297
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-10-22 21:48:12 +00:00
Michael Hudson-Doyle
04557861f1 webdav: skip test that fails with gccgo
Change-Id: Ibcb2fbb6a016046dd67e92372376f0f639979e37
Reviewed-on: https://go-review.googlesource.com/24484
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-27 22:15:07 +00:00
Nigel Tao
d7bf3545bb webdav: respect the Handler.Prefix in confirmLocks.
Fixes golang/go#15967.

Change-Id: I24ffebbe70d15cfd8697c843972f4f1669670f17
Reviewed-on: https://go-review.googlesource.com/24023
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-16 00:25:24 +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
8f3641dedf webdav: rename the "etc/internal/xml" import.
There is no semantic change to this commit. A follow-up commit will
change this package's behavior, but this preparatory commit will make
the follow-up's diff smaller, and less noisy.

Change-Id: I12e356fc1f29d3c4a7c3374aab4a1b1eefe01144
Reviewed-on: https://go-review.googlesource.com/21631
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 02:10:48 +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
Nigel Tao
9622a22758 webdav: fill in the package's doc comment.
Change-Id: I078768667f46d413a65a347185a8fb296b9c5b1e
Reviewed-on: https://go-review.googlesource.com/21633
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 02:09:28 +00:00
Nigel Tao
e000e3cac1 webdav: remove runtime check for Go 1.4 or earlier.
During the Go 1.5 development cycle, this package used to require the
standard library's encoding/xml package from Go 1.5 or later, but
https://go-review.googlesource.com/#/c/12772/ (which was submitted in
July 2015) made an internal fork of encoding/xml, as some
namespace related changes introduced in the Go 1.5 cycle were rolled
back in response to https://github.com/golang/go/issues/11841

Thus, this "go1.4" runtime check is no longer necessary. In the long
term, this package should use the standard library's version, and the
internal fork deleted, once https://github.com/golang/go/issues/13400 is
resolved. We could re-introduce a similar check at that time, although
it could be done at compile time (via a "go1.7" build tag) instead of at
runtime.

Change-Id: I18258443aa3d9b519e23106aedb189f25c35495d
Reviewed-on: https://go-review.googlesource.com/21634
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 02:09:14 +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
Yasuhiro Matsumoto
55cccaa02a x/net/webdav: percent-encode D:href in the XML.
Fixes golang/go#13286

Change-Id: If1e727bc18c64232b82484d9e82063cc59bcc826
Reviewed-on: https://go-review.googlesource.com/16859
Reviewed-by: Robert Stepanek <robert.stepanek@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-11-27 00:52:19 +00:00
Federico Simoncelli
db8e4de5b2 webdav: improve support for url prefixes
StripPrefix in the webdav package strips prefixes from requests
(including the Destination headers) but cannot handle the paths
in the xml entities responses which are confusing some clients
(e.g. cadaver).

This patch replaces StripPrefix with Prefix in the Handler to
handle prefixes both in the requests and in the xml entities
responses.

Change-Id: I67062e30337b2ae422c82a2f927454f5a8a00e34
Reviewed-on: https://go-review.googlesource.com/13857
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-03 01:41:53 +00:00
Mikio Hara
6ba52e3ed9 webdav: skip TestDir on nacl
Updates golang/go#12004.

Change-Id: Id3c1e543a1fc4d246d04d26302b9da46f199fdee
Reviewed-on: https://go-review.googlesource.com/13055
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-04 03:28:21 +00:00
Mikio Hara
7b0ed266d7 webdav: disable TestDir on Plan 9
Updates golang/go#11453.

Change-Id: Ia3560d382daffde995e9824b924d1938f08e6e41
Reviewed-on: https://go-review.googlesource.com/12880
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-30 01:56:12 +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
9339372135 webdav: Refactor XML normalisation for use with multistatusWriter tests.
This CL aims to provide a reusable XML normalisation mechanism across the
golden XML tests.

Change-Id: I39c957f1af4ce4672add38ea6a38c6a7c5f4f25c
Reviewed-on: https://go-review.googlesource.com/11032
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-16 21:07:48 +00:00
Robert Stepanek
3cffabab72 webdav: Refactor property value unmarshaller for reuse with lockInfo.
This CL also makes the golden XML proppatch tests more resilient against
changes in the standard encoding/xml package. lockInfo will be updated
in a follow-up CL.

Change-Id: Ic21a1cec9293db7cdc52aa619b265f8d927fea9e
Reviewed-on: https://go-review.googlesource.com/10827
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-12 23:58:59 +00:00
Nigel Tao
dfcbca9c45 webdav: if TestReadProppatch fails, print InnerXML as a string.
A string is more readable than the default representation of a []byte.

Change-Id: I107c25aa09798df7c7766847beef4de124f44006
Reviewed-on: https://go-review.googlesource.com/10851
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Robert Stepanek <robert.stepanek@gmail.com>
2015-06-10 00:13:49 +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
Nigel Tao
589db58a47 webdav: let DeadPropsHolder.DeadProps return an error.
A DeadPropsHolder could be backed by disk, whether directly or
indirectly via a database, so we should allow for I/O to fail.

Change-Id: Id40bcc86eb854212ef254ea1e1c54fd2a2b1960a
Reviewed-on: https://go-review.googlesource.com/10472
Reviewed-by: Robert Stepanek <robert.stepanek@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-05-29 07:11:33 +00:00