15 Commits

Author SHA1 Message Date
Damien Neil
346cc6157e webdav: relax test to check for any redirect status, not just 301
CL 720820 changed net/http to use a 307 Temporary Redirect instead of
a 301 Moved Permanently when performing an automatic redirect under
some circumstances. Update tests in the webdav package to be agnostic
on the exact redirect status code.

Change-Id: I71784a738d18928a98387ddbd5475d50b19d15bf
Reviewed-on: https://go-review.googlesource.com/c/net/+/723120
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Nicholas Husin <nsh@golang.org>
2025-11-21 16:46:41 -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
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
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
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
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
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
Nigel Tao
7ca853dc26 webdav: add StripPrefix.
Change-Id: I38ac4a507cb79d4295c58f2d8c891e5bdcf0c1e4
Reviewed-on: https://go-review.googlesource.com/10379
Reviewed-by: Robert Stepanek <robert.stepanek@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-05-27 04:42:35 +00:00