Use AsyncHttpRequest to handle async HttpWebRequests.

For some reason, when using HttpWebRequest.GetRequestStreamAsync, the
Amazon Cloud Drive and Box backends would fail when attempting to upload
larger amounts of data (these are the only backends that use the
PostMultipartAsync method).

This fixes issue #3756.
This commit is contained in:
Kenneth Hsu
2019-05-04 16:38:36 -07:00
parent 83bb725dc6
commit ffaaa55f2f
2 changed files with 3 additions and 2 deletions
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using Duplicati.Library.Common.IO;
using Duplicati.Library.Common.IO;
using Duplicati.Library.Interface;
using Newtonsoft.Json;
using System;
@@ -134,9 +134,10 @@ namespace Duplicati.Library
CreateBoundary(out var boundary, out var bodyTerminator);
var req = PreparePostMultipart(url, setup, boundary, bodyTerminator, out var headers, parts);
var areq = new AsyncHttpRequest(req);
var buffer = new byte[Utility.Utility.DEFAULT_BUFFER_SIZE];
using (var rs = await req.GetRequestStreamAsync().ConfigureAwait(false))
using (var rs = areq.GetRequestStream())
{
foreach (var p in headers)
{