Skip to content

Commit

Permalink
fix: Expected an ASCII digit & update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSuunny committed Dec 25, 2023
1 parent cdd990d commit d25cfc1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 13 deletions.
19 changes: 13 additions & 6 deletions HttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ public async Task<HttpResponse> Raw(HttpMethod method, string url, HttpContent b
{
_sentBytes += e;

UploadProgressChanged?.Invoke(this, new UploadEvent(_sentBytes - _headerLength, Content.ContentLength));
if (Content?.ContentLength != null)
{
UploadProgressChanged?.Invoke(this,
new UploadEvent(_sentBytes - _headerLength, Content.ContentLength));
}
};
}

Expand All @@ -330,8 +334,11 @@ public async Task<HttpResponse> Raw(HttpMethod method, string url, HttpContent b
{
_receivedBytes += e;

if (_isReceivedHeader)
DownloadProgressChanged?.Invoke(this, new DownloadEvent(_receivedBytes - _response.HeaderLength, _response.ContentLength));
if (_isReceivedHeader && _response?.ContentLength != null)
{
DownloadProgressChanged?.Invoke(this,
new DownloadEvent(_receivedBytes - _response.HeaderLength, _response.ContentLength));
}
};
}

Expand Down Expand Up @@ -570,13 +577,13 @@ private string GenerateHeaders(HttpMethod method, long contentLength = 0, string
StringBuilder headerBuilder = new();

foreach (string header in rawHeaders)
headerBuilder.AppendFormat($"{header}: {rawHeaders[header]}\r\n");
headerBuilder.Append($"{header}: {rawHeaders[header]}\r\n");

foreach (string header in Headers)
headerBuilder.AppendFormat($"{header}: {Headers[header]}\r\n");
headerBuilder.Append($"{header}: {Headers[header]}\r\n");

foreach (string header in TempHeaders)
headerBuilder.AppendFormat($"{header}: {TempHeaders[header]}\r\n");
headerBuilder.Append($"{header}: {TempHeaders[header]}\r\n");

TempHeaders.Clear();

Expand Down
14 changes: 7 additions & 7 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>net6.0;net5.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0</TargetFrameworks>
<LangVersion>10</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageId>Yove.Http</PackageId>
<Version>1.6.5</Version>
<Version>1.6.6</Version>
<Authors>Sunny</Authors>
<NeutralLanguage>en-US, ru-RU</NeutralLanguage>
<Description>Http Client for .Net | Http, Socks4, Socks5 client</Description>
Expand All @@ -18,10 +18,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Fody" Version="6.6.4"/>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.1" PrivateAssets="All"/>
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="Fody" Version="6.8.0"/>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.2" PrivateAssets="All"/>
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions Yove.Http.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yove.Http", "Yove.Http.csproj", "{F11B5F57-40A9-41DE-815A-9E37F97A70FB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F11B5F57-40A9-41DE-815A-9E37F97A70FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F11B5F57-40A9-41DE-815A-9E37F97A70FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F11B5F57-40A9-41DE-815A-9E37F97A70FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F11B5F57-40A9-41DE-815A-9E37F97A70FB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CB848D60-1527-492E-9E1F-33C88BE67536}
EndGlobalSection
EndGlobal

0 comments on commit d25cfc1

Please sign in to comment.