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: missing "getlastmodified" on directories #15334

Closed
igungor opened this issue Apr 16, 2016 · 10 comments
Closed

x/net/webdav: missing "getlastmodified" on directories #15334

igungor opened this issue Apr 16, 2016 · 10 comments

Comments

@igungor
Copy link

igungor commented Apr 16, 2016

I'm using go 1.6, x/net/webdav: golang/net@d75b190
goenv: GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/ibrahim" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GO15VENDOREXPERIMENT="1" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common" CXX="clang++" CGO_ENABLED="1"

"getlastmodified" live property is off by default for directories. Is that intentional, or a webdav spec thing?

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

// CC: @nigeltao

@bradfitz bradfitz added this to the Unreleased milestone Apr 16, 2016
@bradfitz bradfitz changed the title x/net/webdav x/net/webdav: missing "getlastmodified" on directories Apr 16, 2016
@nigeltao
Copy link
Contributor

Hmm... I can't remember if that's a WebDAV spec thing. Perhaps @rsto or @davecheney have an opinion.

@rsto
Copy link
Contributor

rsto commented Apr 22, 2016

That's intentional. net/webdav doesn't support GET on directories but the WebDAV spec expects the getlastmodified property to only be defined for GETable resources (see here).

That's the reason why all the DAV:get* properties in prop.go are disabled for directories.

Is this causing issues with a WebDAV client?

@igungor
Copy link
Author

igungor commented Apr 22, 2016

No, it's not causing any problem at all. I just see the modtimes of all directories as unix epoch and I wondered why. Thanks for the clarification.

@igungor igungor closed this as completed Apr 22, 2016
@igungor
Copy link
Author

igungor commented May 23, 2016

Hey again,

I've thought about this issue at length and it feels wrong that folders (collection) do not supposed to have mtime.

I've looked at nginx and apache, and they both send 'getlastmodified' live property for the folders I stat. Missing 'getlastmodified' for folders prevents clients to sort all files and folders correctly, since they all have the same mtime, which is Unix epoch.

What do you think?

Not a concrete clue but just for the sake of reference:

nginx webdav module: https://github.com/arut/nginx-dav-ext-module/blob/master/ngx_http_dav_ext_module.c#L374

apache webdav module: https://github.com/apache/httpd/blob/8322599c746bbdf1410a098a5d4764499baf7670/modules/dav/fs/repos.c#L1959

@igungor igungor reopened this May 23, 2016
@rsto
Copy link
Contributor

rsto commented May 23, 2016

I was not aware of any client issues around getlastmodified. Do you know which clients are affected?

If there are real issues, I agree that net/webdav should support this use case, even if it deviates from the RFC. Returning this property for directories most probably won't break properly implemented clients anyways (but that's just me guessing).

@igungor
Copy link
Author

igungor commented May 24, 2016

I'm testing it with Cyberduck, Cadaver and Kodi. Try to sort folders by date, and they will sort by name because folders have the same modified-date since they don't have 'getlastmodified' property at all.

@rsto
Copy link
Contributor

rsto commented May 24, 2016

If you send a patch I'll be happy to review it. It's @nigeltao, who decides if the change gets accepted.

@igungor
Copy link
Author

igungor commented May 25, 2016

@gopherbot
Copy link

CL https://golang.org/cl/23422 mentions this issue.

@nigeltao
Copy link
Contributor

Do apache and nginx honor a GET request on directories? If so, what's the response body?

@golang golang locked and limited conversation to collaborators May 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants