Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/webdav: PUT handler does not support conditional requests using If-... headers #44492

Open
jbeisswenger-cetitec opened this issue Feb 22, 2021 · 0 comments

Comments

@jbeisswenger-cetitec
Copy link

@jbeisswenger-cetitec jbeisswenger-cetitec commented Feb 22, 2021

What version of Go are you using (go version)?

$ go version
go version go1.15.6 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jbe/.cache/go-build"
GOENV="/home/jbe/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jbe/go/pkg/mod"
GONOPROXY="redacted"
GONOSUMDB="redacted"
GOOS="linux"
GOPATH="/home/jbe/go"
GOPRIVATE="redacted"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build221351055=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. Create a resource using put.
  2. Overwrite the resource with another put.
  3. Make a conditional GET request using a condition which is invalidated by step 2.
  4. Make a conditional PUT request using the same unsatisfied condition used in step 3.

Example using If-Unmodified-Since: https://play.golang.org/p/yf4YRknvXRe

Example using If-Match: https://play.golang.org/p/a6nl_v-R_vE

Note: It was necessary to run the examples twice on the playground, the first run timed out during compilation.

These types of conditional requests are useful to avoid the lost update problem without using WebDAV locks.

What did you expect to see?

After running any of the provided examples I expect both GET and PUT requests failing with 412 Precondition Failed -- producing the following output:

412 Precondition Failed
412 Precondition Failed

What did you see instead?

The second request (PUT) succeeded:

412 Precondition Failed
201 Created
@gopherbot gopherbot added this to the Unreleased milestone Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants