The webdav saver code in TiddlyWiki should be in
$:/core/modules/savers/put.js or something like that. I know it ends with
put.js

On Oct 18, 2017 09:12, "Lost Admin" <[email protected]> wrote:

Could someone help me a bit with something? My coding skills are not up to
even this simple task sadly.

The WebDAV saver for TiddlyWiki saves using the HTTP PUT method.
Unfortunately the Apache and IIS implementations of WebDAV do not respond
with the updated ETag header. However, according to the documentation, the
HTTP HEAD method should respond with the new ETAG. So, I would like to
modify the WebDAV saver to do the following:

1) call the HTTP LOCK method to lock the file
2) call the HTTP PUT method to save the file (as it does today with the
ETAG and everything)

3) If save fails: return the error message (like we do today)
4) if save succeeds: call the HTTP HEAD method to get the updated ETag

5) call the HTTP UNLOCK method to release the lock on the file

NOTES:

If I read the documentation correctly, HTTP locks have a timeout. So if an
issue occurs during the locked phase, the file should be released in a few
minutes.

I'm not bothering to actually check if we got a lock after step 1 because
we will still get an error from the PUT call due to either another file
lock or the ETag miss-match.

The UNLOCK response doesn't need to be communicated to the end-user because
it should only fail if the initial lock failed (or there is some miss-match
in the lock token). This could even be done asynchronously.

We could conceivably use the HTTP LOCK method to lock a tiddlywiki when it
is being edited but the LOCK method has a timeout, so we would need to
periodically re-request the lock. Right now I prefer the  opportunistic
locking method we are using with ETag. The only reason to use the lock
around the PUT and HEAD calls is to ensure that the ETag we get is the one
that matches the data we just saved and not the data submitted by another
person at almost the same time.

In Apache, the lock method is optional and requires some additional set-up.
By ignoring the success/failure of the lock, we nicely fall-back to the
current ETag method.

Thoughts? Suggestions? Pointers to where I find the parts of the WebDAV
saver code in tiddlywiki to attempt to make these changes myself?

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAJ1vdST21KdCqiX8FZRs7kKAJh%2BZmEWRsPKxNmBKOEbMZ0aqgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to