bugdavfs2 - Bugs: bug #56905, Option to add mtime to header...

 
 

bug #56905: Option to add mtime to header during dav_put?

Submitter:  None
Submitted:  Mon 16 Sep 2019 08:48:47 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  _71007
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 30 Sep 2019 06:49:19 PM UTC, comment #3: 

The Date-header contains the time when the request or response is sent.

It is the Last-Modified header that is equivalent to the mtime. Most servers will set it to the value of the file's mtime on the server.

"But using ImageMagick on the command line in a batch processing is probably one of the use-cases for davfs2."
It surely is.

How davfs2 handles file times:
Davfs2 maintains locally mtime, ctime and atime and will serve this times on file system requests. It additionally stores the Last-Modified time from the server.
When davfs2 lerns about a remote file for the first time it will set the local times to the value of Last-Modified. Local file system actions will update the locally maintained times.
If the file on the server is changed by some other client and therefore Last-Modified changes, this will also change the local mtime - if it is more recent.
This local times are maintained as long as the file system is mounted. If the file system is umounted it is only stored for those files that are still in the cache.
 Your application will always get either the local mtime or the time of the last upload to the server.

If you really need the time of the last local modification you can of course store that in some extra file on the server.

Werner

- <_71007>
Mon 30 Sep 2019 09:18:13 AM UTC, comment #2: 

Hi Werner

Thanks for looking into this and your reply.

Having custom headers, set at mount time, would obviously be custom, but make davfs2 more interoperable towards servers.

Regarding the mtime in the HTTP-header: do you mean the "Date" header (RFC 2616, Section 14.18) of the PUT request, or do you mean the "Last-Modified" (Section 14.29) of the entity header (7.1)? Do you send both headers?

I know that it would be better to build the access into an application. But using ImageMagick on the command line in a batch processing is probably one of the use-cases for davfs2. :-)

Thanks again for your time.
Martin.

Martin Rüegg <metaworx>
Fri 27 Sep 2019 04:55:26 PM UTC, comment #1: 

I will not add costum headers to davfs2. The reasons:

  • These headers will only be recognized by davfs2 and are not interoperable.


  • You will have two mtimes - the one from the regular HTTP-header and the one from the costum header - and they will be different.


  • Generally: davfs2 is not created to have an additional network file system. The WebDAV-protocol would be very badly designed for this purpose. WebDAV is intended to be built into applications that are used to edit resources on an HTTP-server. davfs2 is only for those programs that lack WebDAV-support. The file system interface is choosen because almost any application is able to use it.


Because ot this I will not try to make davfs2 a fully capable file system.

Werner

- <_71007>
Mon 16 Sep 2019 08:48:47 PM UTC, original submission:  


Hello Werner

Thanks for this amazing piece of software!

Unfortunately, the WebDAV standard has not foreseen a way to set the modification time when creating a resource. However, when uploading a file (e.g. a foto) it would be great if the file time was not set to the current date. Nextcloud, a WebDAV server, uses a custom header to provide the mtime during upload, so that the file system time is preserved.

Would you consider implementing an option (e.g. mtime_header) that could be set to the mtime of the file during dav_put()? The default would be null and hence the header not set. But if the option was set (e.g. to "X-OC-Mtime") then a unix timestamp would be added as this header's value. Something along the lines of

if (mtime_header)
    ne_add_request_header(req, mtime_header, st.st_mtime);

@http://cvs.savannah.nongnu.org/viewvc/davfs2/davfs2/src/webdav.c?view=markup#l985


Thank you for your kind consideration. Happy to help testing, if required.

Kind regards,
Martin.





Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by metaworx (Posted a comment)
  • -email is unavailable- added by _71007 (Posted a comment)
  • -email is unavailable- added by metaworx (orignial submitter)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-26 _71007 Open/ClosedOpen Closed
    2019-09-27 _71007 StatusNone Invalid
        Assigned toNone _71007
    2019-09-16 metaworx Carbon-Copy- Added metaworx

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code