Commits

Jack Zhou  committed 765ba61

Fixed a bug where the database cannot be saved to dropbox on mono.

  • Participants
  • Parent commits 3824bf6

Comments (0)

Files changed (2)

File KeeCloud/WebRequests/ProviderWebRequest.cs

         private readonly IProvider provider;
         private IPluginHost host;
 
-        RequestStream requestStream = new RequestStream();
+        RequestStream requestStream;
 
         public ProviderWebRequest(Uri uri, IProvider provider, IPluginHost host)
         {
             this.Headers = new WebHeaderCollection();
 
+            this.requestStream = new RequestStream(this);
             this.requestUri = uri;
             this.provider = provider;
             this.host = host;

File KeeCloud/WebRequests/RequestStream.cs

-using System;
+using KeePassLib.Native;
+using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 {
     class RequestStream : Stream
     {
+        private readonly ProviderWebRequest _request;
+
+        public RequestStream(ProviderWebRequest request)
+        {
+            _request = request;
+        }
+
+        public override void Close()
+        {
+            if (NativeLib.IsUnix()) // mono does not automatically call GetResponse
+            {
+                _request.GetResponse();
+            }
+        }
+
         List<byte> bytes = new List<byte>();
         public override bool CanRead
         {