Bump default MaxStringContentLength for WCF

This commit is contained in:
JustArchi
2017-02-23 17:40:12 +01:00
parent aeae5a1c9b
commit 441651d29b
2 changed files with 12 additions and 1 deletions

View File

@@ -112,6 +112,7 @@
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="Microsoft.CSharp" />

View File

@@ -202,6 +202,9 @@ namespace ArchiSteamFarm {
switch (Program.GlobalConfig.WCFBinding) {
case GlobalConfig.EWCFBinding.NetTcp:
result = new NetTcpBinding {
// This is a balance between default of 8192 which is not enough, and int.MaxValue which is prone to DoS attacks
ReaderQuotas = { MaxStringContentLength = ushort.MaxValue },
// We use SecurityMode.None for Mono compatibility
// Yes, also on Windows, for Mono<->Windows communication
Security = { Mode = SecurityMode.None }
@@ -209,10 +212,17 @@ namespace ArchiSteamFarm {
break;
case GlobalConfig.EWCFBinding.BasicHttp:
result = new BasicHttpBinding();
result = new BasicHttpBinding {
// This is a balance between default of 8192 which is not enough, and int.MaxValue which is prone to DoS attacks
ReaderQuotas = { MaxStringContentLength = ushort.MaxValue }
};
break;
case GlobalConfig.EWCFBinding.WSHttp:
result = new WSHttpBinding {
// This is a balance between default of 8192 which is not enough, and int.MaxValue which is prone to DoS attacks
ReaderQuotas = { MaxStringContentLength = ushort.MaxValue },
// We use SecurityMode.None for Mono compatibility
// Yes, also on Windows, for Mono<->Windows communication
Security = { Mode = SecurityMode.None }