From ff3ecad6d1da70b12cb5b58f742aa4bca45f08d2 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Mon, 24 Feb 2020 21:11:54 +0100 Subject: [PATCH] Add workaround for POST limit size --- ArchiSteamFarm/Trading.cs | 2 +- ArchiSteamFarm/WebBrowser.cs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ArchiSteamFarm/Trading.cs b/ArchiSteamFarm/Trading.cs index 95f09cc07..dac03cde6 100644 --- a/ArchiSteamFarm/Trading.cs +++ b/ArchiSteamFarm/Trading.cs @@ -35,7 +35,7 @@ using SteamKit2; namespace ArchiSteamFarm { public sealed class Trading : IDisposable { - internal const byte MaxItemsPerTrade = byte.MaxValue; // This is decided upon various factors, mainly limit on POST size in WebBrowser, as well as stability of Steam servers when dealing with huge trade offers + internal const byte MaxItemsPerTrade = byte.MaxValue; // This is decided upon various factors, mainly stability of Steam servers when dealing with huge trade offers internal const byte MaxTradesPerAccount = 5; // This is limit introduced by Valve private readonly Bot Bot; diff --git a/ArchiSteamFarm/WebBrowser.cs b/ArchiSteamFarm/WebBrowser.cs index f09855f73..08cc92dd4 100644 --- a/ArchiSteamFarm/WebBrowser.cs +++ b/ArchiSteamFarm/WebBrowser.cs @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -553,10 +554,8 @@ namespace ArchiSteamFarm { if (data != null) { try { request.Content = new FormUrlEncodedContent(data); - } catch (UriFormatException e) { - ArchiLogger.LogGenericException(e); - - return null; + } catch (UriFormatException) { + request.Content = new StringContent(string.Join("&", data.Select(kv => WebUtility.UrlEncode(kv.Key) + "=" + WebUtility.UrlEncode(kv.Value))), null, "application/x-www-form-urlencoded"); } }