Skip to content

Commit

Permalink
fix: MaxReciveBufferSize
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSuunny committed Feb 4, 2024
1 parent 0b3298e commit 0d4b248
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Content/MultipartContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Yove.Http;

public class MultipartContent : HttpContent, IEnumerable<HttpContent>, IDisposable
{
private readonly List<Element> _elements = new();
private readonly List<Element> _elements = [];

private string _boundary { get; }

Expand Down
12 changes: 7 additions & 5 deletions HttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace Yove.Http;
public class HttpClient : IDisposable
{
#region Public
public NameValueCollection Headers = new();
public NameValueCollection TempHeaders = new();
public NameValueCollection Headers = [];
public NameValueCollection TempHeaders = [];

public NameValueCollection Cookies { get; set; }

Expand Down Expand Up @@ -59,7 +59,7 @@ public class HttpClient : IDisposable
public int ReconnectDelay { get; set; } = 1000;
public int TimeOut { get; set; } = 60000;
public int ReadWriteTimeOut { get; set; } = 60000;
public int MaxReciveBufferSize { get; set; } = 2147483647;
public long MaxReciveBufferSize { get; set; } = 3147483647;

public Uri Address { get; private set; }

Expand Down Expand Up @@ -111,7 +111,7 @@ public ProxyClient Proxy
internal HttpMethod Method { get; set; }
internal HttpContent Content { get; set; }

internal List<RedirectItem> RedirectHistory = new();
internal List<RedirectItem> RedirectHistory = [];

internal RemoteCertificateValidationCallback AcceptAllCertificationsCallback = new(AcceptAllCertifications);

Expand Down Expand Up @@ -348,7 +348,9 @@ public async Task<HttpResponse> Raw(HttpMethod method, string url, HttpContent b
catch (Exception ex)
{
if (ex?.InnerException?.Message == "bad protocol version")
#pragma warning disable SYSLIB0039 // Type or member is obsolete
DefaultSslProtocols = SslProtocols.Tls11;
#pragma warning restore SYSLIB0039 // Type or member is obsolete

if (_canReconnect)
return await Reconnect(method, url, body);
Expand Down Expand Up @@ -496,7 +498,7 @@ private async Task<TcpClient> CreateConnection(string host, int port)

private string GenerateHeaders(HttpMethod method, long contentLength = 0, string contentType = null)
{
NameValueCollection rawHeaders = new();
NameValueCollection rawHeaders = [];

if (Address.IsDefaultPort)
rawHeaders["Host"] = Address.Host;
Expand Down
6 changes: 3 additions & 3 deletions HttpResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class HttpResponse
private HttpClient _request { get; }
private Receiver _content { get; }

public NameValueCollection Headers = new();
public NameValueCollection Cookies = new();
public List<RedirectItem> RedirectHistory = new();
public NameValueCollection Headers = [];
public NameValueCollection Cookies = [];
public List<RedirectItem> RedirectHistory = [];

public string ContentType { get; }
public string ContentEncoding { get; }
Expand Down
4 changes: 2 additions & 2 deletions Yove.Http.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<LangVersion>10</LangVersion>
<LangVersion>12</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageId>Yove.Http</PackageId>
<Version>1.6.7</Version>
<Version>1.6.8</Version>
<Authors>Sunny</Authors>
<NeutralLanguage>en-US, ru-RU</NeutralLanguage>
<Description>Http Client for .Net | Http, Socks4, Socks5 client</Description>
Expand Down

0 comments on commit 0d4b248

Please sign in to comment.