You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
linux/amd64
What did you do?
I am have written a webdav server for rclone which can serve any rclone remote as a webdav endpoint (use with rclone serve webdav remote:path)
It all works very well - thank you for a great module!
However I've noticed that it is less efficient than it could be.
In order to read the getcontenttype property on each file, the findContentType function opens the file, reads 512 bytes and works out the content type. This is a really expensive operation for an rclone backend as it has to do a network connection for each open.
In fact rclone already knows the content type for each file but there is no way to supply it.
So I'd like to fix this. I can think of a few ways of doing this
Make findContentType optionally just use the file name to work out the content type. This is a bit approximate but probably good enough. This could be be enabled and disabled by a method on Handler.
Allow the findContentType function to be overridden. This would need a method on handler, say something like func OverrideLiveProp(name xml.Name, fn findFn, dir bool) which would work on a copy of liveProps in the Handler struct.
Get findContentType to look for an optional interface interface ContentTyper { func ContentType() string } on the fi os.FileInfo passed in and use that if available.
I think option 3 is probably the neatest, but least extensible option.
@nigeltao Your thoughts would be appreciated before I send a CL!
The text was updated successfully, but these errors were encountered:
@nigeltao I've made a CL implementing this interface and also one for Etag (which it turns out is useful for me too!). See https://golang.org/cl/109217 - thanks!
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
I am have written a webdav server for rclone which can serve any rclone remote as a webdav endpoint (use with
rclone serve webdav remote:path
)It all works very well - thank you for a great module!
However I've noticed that it is less efficient than it could be.
In order to read the
getcontenttype
property on each file, the findContentType function opens the file, reads 512 bytes and works out the content type. This is a really expensive operation for an rclone backend as it has to do a network connection for each open.In fact rclone already knows the content type for each file but there is no way to supply it.
So I'd like to fix this. I can think of a few ways of doing this
func OverrideLiveProp(name xml.Name, fn findFn, dir bool)
which would work on a copy ofliveProps
in the Handler struct.interface ContentTyper { func ContentType() string }
on thefi os.FileInfo
passed in and use that if available.I think option 3 is probably the neatest, but least extensible option.
@nigeltao Your thoughts would be appreciated before I send a CL!
The text was updated successfully, but these errors were encountered: