From ffaaa55f2f2b44e8a60d06d3222e1ff3c3a0a9bb Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 4 May 2019 16:34:36 -0700 Subject: [PATCH] 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. --- Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs | 2 +- Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs b/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs index 41b4bfa29..98ee79afd 100644 --- a/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs +++ b/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs @@ -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; diff --git a/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs b/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs index dbe43c18c..ef5e13a3e 100644 --- a/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs +++ b/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs @@ -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) {