Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#89 Fix no PUT at WebDAV-Sync with mono-3.x

KeePass_2.x
closed
nobody
None
5
2014-05-10
2014-05-04
David Lechner
No

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.

1 Attachments

Discussion

  • Dominik Reichl
    Dominik Reichl
    2014-05-06

    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

     
  • David Lechner
    David Lechner
    2014-05-06

    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.

     
  • Dominik Reichl
    Dominik Reichl
    2014-05-06

    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

     
  • David Lechner
    David Lechner
    2014-05-06

    That sounds like a much better approach.

     
  • Dominik Reichl
    Dominik Reichl
    2014-05-08

    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

     
  • David Lechner
    David Lechner
    2014-05-08

    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.

     
  • Dominik Reichl
    Dominik Reichl
    2014-05-10

    Great, thanks a lot for testing it!

    Best regards,
    Dominik

     
  • Dominik Reichl
    Dominik Reichl
    2014-05-10

    • status: open --> closed