Fix no PUT at WebDAV-Sync with mono-3.x
A lightweight and easy-to-use password manager
Brought to you by:
dreichl
This is in response to https://sourceforge.net/p/keepass/discussion/329221/thread/9422258c/ and also https://sourceforge.net/p/keepass/bugs/1117/
It seems that this a "feature" in Mono 3.x. The changed was introduced to fix https://bugzilla.xamarin.com/show_bug.cgi?id=1512
I have implemented a workaround.
I don't really like this patch yet. Apparently it introduces a change in the database serialization code; however a more appropriate place would be the IOConnection code (because there are other features that also write using IOConnection, e.g. the export function, key files, lock files, and file transactions in general).
Am I correct that the core idea of your patch is to call GetResponse for the WebRequest after closing the data stream?
Thanks and best regards,
Dominik
Yes, the core idea is that you have to explicitly call GetResponse on the WebRequest in order for the request to actually be sent.
This seemed like the only place to put the workaround to make sure that the file was written before the copy was deleted. I will dig deeper to see if there is a better way to do this. I can see that I am probably missing some cases.
One idea would be to create a new class derived from Stream that calls GetResponse when closing (I did something similar in the IOProtocolExt plugin before); I'll add this in the next few days and post it for review.
Best regards,
Dominik
That sounds like a much better approach.
I've implemented this now.
Here's the latest development snapshot (including the modified source code files):
http://keepass.info/filepool/KeePass_140508b_s.zip
(note that 'MonoWorkarounds.cs' and some of the native methods have moved from the 'KeePass' namespace to 'KeePassLib'; otherwise KeePassLib would not build anymore).
As I currently don't have a WebDAV server for testing, it would be great if you could test it.
Thanks and best regards,
Dominik
I've tested saving and exporting on Ubuntu 14.04/Mono 2.3.8 and it does fix the problem. The StreamWrapper is a good catch-all solution to cover all of the possible uses - I'll have to remember that if I ever run into a similar problem.
Great, thanks a lot for testing it!
Best regards,
Dominik