webdav: try to handle HEAD for collection too

The underlying golang webdav library returns Method Not Allowed for
HEAD requests on directories:

https://github.com/golang/net/blob/master/webdav/webdav.go#L210

let's see if we can workaround this inside SFTPGo itself in a similar
way as we do for GET.

The HEAD response will not return a Content-Length, we cannot handle
this inside SFTPGo.

Fixes #294
This commit is contained in:
Nicola Murino
2021-02-03 22:36:13 +01:00
parent 4872ba2ea0
commit fc9082c422
4 changed files with 55 additions and 27 deletions

14
go.mod
View File

@@ -3,12 +3,12 @@ module github.com/drakkan/sftpgo
go 1.15
require (
cloud.google.com/go v0.75.0 // indirect
cloud.google.com/go v0.76.0 // indirect
cloud.google.com/go/storage v1.12.0
github.com/Azure/azure-storage-blob-go v0.13.0
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962
github.com/alexedwards/argon2id v0.0.0-20201228115903-cf543ebc1f7b
github.com/aws/aws-sdk-go v1.37.1
github.com/aws/aws-sdk-go v1.37.2
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/eikenb/pipeat v0.0.0-20200430215831-470df5986b6d
github.com/fclairamb/ftpserverlib v0.12.0
@@ -27,7 +27,7 @@ require (
github.com/lib/pq v1.9.0
github.com/magiconair/properties v1.8.4 // indirect
github.com/mattn/go-sqlite3 v1.14.6
github.com/miekg/dns v1.1.37 // indirect
github.com/miekg/dns v1.1.38 // indirect
github.com/minio/sha256-simd v0.1.1
github.com/minio/sio v0.2.1
github.com/mitchellh/mapstructure v1.4.1 // indirect
@@ -52,19 +52,15 @@ require (
github.com/yl2chen/cidranger v1.0.2
go.etcd.io/bbolt v1.3.5
go.opencensus.io v0.22.6 // indirect
go.uber.org/automaxprocs v1.3.0
go.uber.org/automaxprocs v1.4.0
gocloud.dev v0.21.0
gocloud.dev/secrets/hashivault v0.21.0
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013 // indirect
golang.org/x/oauth2 v0.0.0-20210201163806-010130855d6c // indirect
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
golang.org/x/text v0.3.5 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
golang.org/x/tools v0.1.0 // indirect
google.golang.org/api v0.38.0
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506 // indirect
google.golang.org/grpc v1.35.0 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.4.0 // indirect