Skip to content

Commit

Permalink
feat: update nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSuunny committed Jun 17, 2022
1 parent bea180f commit 57ee144
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 27 deletions.
3 changes: 2 additions & 1 deletion FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<Weavers>
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>
30 changes: 30 additions & 0 deletions FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
16 changes: 10 additions & 6 deletions HttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,19 +465,23 @@ private async Task<TcpClient> CreateConnection(string host, int port)

using CancellationTokenSource cancellationToken = new(TimeSpan.FromMilliseconds(TimeOut));

ValueTask connectionTask = tcpClient.ConnectAsync(host, port, cancellationToken.Token);

try
{
await connectionTask;
#if NETSTANDARD2_1 || NETCOREAPP3_1
tcpClient.ConnectAsync(host, port).Wait(cancellationToken.Token);
#elif NET5_0_OR_GREATER
await tcpClient.ConnectAsync(host, port, cancellationToken.Token);
#endif

if (!tcpClient.Connected)
throw new();
}
catch
{
throw new HttpRequestException($"Failed Connection to Address: {Address.AbsoluteUri}");
}
tcpClient.Dispose();

if (!tcpClient.Connected)
throw new HttpRequestException($"Failed Connection to Address: {Address.AbsoluteUri}");
}

return tcpClient;
}
Expand Down
18 changes: 11 additions & 7 deletions Proxy/ProxyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,23 @@ internal async Task<TcpClient> CreateConnection(string destinationHost, int dest

using CancellationTokenSource cancellationToken = new(TimeSpan.FromMilliseconds(TimeOut));

ValueTask connectionTask = tcpClient.ConnectAsync(Host, Port, cancellationToken.Token);

try
{
await connectionTask;
#if NETSTANDARD2_1 || NETCOREAPP3_1
tcpClient.ConnectAsync(Host, Port).Wait(cancellationToken.Token);
#elif NET5_0_OR_GREATER
await tcpClient.ConnectAsync(Host, Port, cancellationToken.Token);
#endif

if (!tcpClient.Connected)
throw new();
}
catch
{
throw new HttpProxyException($"Failed Connection to proxy: {Host}:{Port}");
}
tcpClient.Dispose();

if (!tcpClient.Connected)
throw new HttpProxyException($"Failed Connection to proxy: {Host}:{Port}");
throw new HttpRequestException($"Failed Connection to proxy: {Host}:{Port}");
}

NetworkStream networkStream = tcpClient.GetStream();

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Yove.Http | Http Client / Http Framework

[![NuGet version](https://badge.fury.io/nu/Yove.Http.svg)](https://badge.fury.io/nu/Yove.Http)
[![Downloads](https://img.shields.io/nuget/dt/Yove.Http.svg)](https://www.nuget.org/packages/Yove.Http)
[![NuGet version](https://badge.fury.io/nu/Yove.HttpClient.svg)](https://badge.fury.io/nu/Yove.HttpClient)
[![Downloads](https://img.shields.io/nuget/dt/Yove.HttpClient.svg)](https://www.nuget.org/packages/Yove.HttpClient)
[![Target](https://img.shields.io/badge/.NET%20Standard-2.0-green.svg)](https://docs.microsoft.com/ru-ru/dotnet/standard/net-standard)

Nuget: https://www.nuget.org/packages/Yove.Http/
Nuget: https://www.nuget.org/packages/Yove.HttpClient

```
Install-Package Yove.Http
Install-Package Yove.HttpClient
```

```
dotnet add package Yove.Http
dotnet add package Yove.HttpClient
```

---
Expand Down
12 changes: 4 additions & 8 deletions Yove.Http.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net5.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<LangVersion>10</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<DisableFody>true</DisableFody>
</PropertyGroup>

<PropertyGroup>
<PackageId>Yove.HttpClient</PackageId>
<Version>1.6.0</Version>
<Version>1.6.1</Version>
<Authors>Sunny</Authors>
<NeutralLanguage>en-US, ru-RU</NeutralLanguage>
<Description>Http Client for .Net | Http, Socks4, Socks5 client</Description>
<TargetFrameworks>net6.0</TargetFrameworks>
<PackageTags>http; client; framework; .net core; .net; socks4; socks5; https;</PackageTags>
<PackageProjectUrl>https://github.com/TheSuunny/Yove.Http</PackageProjectUrl>
<RepositoryUrl>https://github.com/TheSuunny/Yove.Http</RepositoryUrl>
Expand All @@ -26,6 +22,6 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Fody" Version="6.6.3"/>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.1"/>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.1" PrivateAssets="All"/>
</ItemGroup>
</Project>

0 comments on commit 57ee144

Please sign in to comment.