Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port handler-proxy (http-only) #71

Merged
merged 4 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions DotNetty.sln
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "local-build", "local-build"
localRestore.cmd = localRestore.cmd
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetty.Handlers.Proxy", "src\DotNetty.Handlers.Proxy\DotNetty.Handlers.Proxy.csproj", "{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetty.Handlers.Proxy.Tests", "test\DotNetty.Handlers.Proxy.Tests\DotNetty.Handlers.Proxy.Tests.csproj", "{8A11F53C-02FD-4537-9BC9-0525489F128B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -520,6 +524,38 @@ Global
{920F73C7-7FBE-44BE-8A99-3A394207D4C8}.Release|x64.Build.0 = Release|Any CPU
{920F73C7-7FBE-44BE-8A99-3A394207D4C8}.Release|x86.ActiveCfg = Release|Any CPU
{920F73C7-7FBE-44BE-8A99-3A394207D4C8}.Release|x86.Build.0 = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|ARM.Build.0 = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|x64.ActiveCfg = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|x64.Build.0 = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|x86.ActiveCfg = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Debug|x86.Build.0 = Debug|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|Any CPU.Build.0 = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|ARM.ActiveCfg = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|ARM.Build.0 = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|x64.ActiveCfg = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|x64.Build.0 = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|x86.ActiveCfg = Release|Any CPU
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC}.Release|x86.Build.0 = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|ARM.Build.0 = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|x64.ActiveCfg = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|x64.Build.0 = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|x86.ActiveCfg = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Debug|x86.Build.0 = Debug|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|Any CPU.Build.0 = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|ARM.ActiveCfg = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|ARM.Build.0 = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|x64.ActiveCfg = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|x64.Build.0 = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|x86.ActiveCfg = Release|Any CPU
{8A11F53C-02FD-4537-9BC9-0525489F128B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -553,6 +589,8 @@ Global
{E6B102FE-C706-4C40-B4F9-569EFC89B70F} = {01F3CC7E-F996-411E-AFD6-72673A826549}
{920F73C7-7FBE-44BE-8A99-3A394207D4C8} = {01F3CC7E-F996-411E-AFD6-72673A826549}
{E27C94F8-A148-46D4-A1E0-2CC2B1FBECE9} = {013DFD29-E1DB-4968-A67B-C2342E6F5B6E}
{9A960CAF-E1BB-49F0-8F4F-7FA52F787CFC} = {3D04C4DC-6F8E-4326-9569-92F3E26C6EEB}
{8A11F53C-02FD-4537-9BC9-0525489F128B} = {01F3CC7E-F996-411E-AFD6-72673A826549}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A659CEFB-DDB3-49BE-AEDD-FF2F1B3297DB}
Expand Down
2 changes: 2 additions & 0 deletions src/DotNetty.Codecs/Base64/Base64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public static class Base64
const sbyte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding

public static IByteBuffer Encode(IByteBuffer src) => Encode(src, Base64Dialect.Standard);

public static IByteBuffer Encode(IByteBuffer src, bool breakLines) => Encode(src, breakLines, Base64Dialect.Standard);

public static IByteBuffer Encode(IByteBuffer src, IBase64Dialect dialect) => Encode(src, src.ReaderIndex, src.ReadableBytes, dialect.BreakLinesByDefault, dialect);

Expand Down
24 changes: 24 additions & 0 deletions src/DotNetty.Handlers.Proxy/DotNetty.Handlers.Proxy.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\nuget.props" />

<PropertyGroup>
<TargetFrameworks>$(StandardTfms)</TargetFrameworks>
<RootNamespace>DotNetty.Handlers.Proxy</RootNamespace>
<AssemblyName>SpanNetty.Handlers.Proxy</AssemblyName>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup Label="NuGet">
<PackageId>SpanNetty.Handlers.Proxy</PackageId>
<Title>SpanNetty.Handlers.Proxy</Title>
<Description>Protobuf Proto3 codec.</Description>
<PackageTags>socket;tcp;protocol;netty;dotnetty;network;proxy;webproxy;httpproxy;tunnelproxy</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DotNetty.Codecs.Http\DotNetty.Codecs.Http.csproj" />
<ProjectReference Include="..\DotNetty.Transport\DotNetty.Transport.csproj" />
</ItemGroup>

<Import Project="..\version.props" />
</Project>
47 changes: 47 additions & 0 deletions src/DotNetty.Handlers.Proxy/HttpProxyConnectException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Copyright (c) 2020 The Dotnetty-Span-Fork Project ([email protected]) All rights reserved.
*
* https://github.com/cuteant/dotnetty-span-fork
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/

using DotNetty.Codecs.Http;

namespace DotNetty.Handlers.Proxy
{
/// <summary>
/// Specific case of a connection failure, which may include headers from the proxy.
/// </summary>
public sealed class HttpProxyConnectException : ProxyConnectException
{
/// <summary>
/// @param message The failure message.
/// @param headers Header associated with the connection failure. May be {@code null}.
/// </summary>
public HttpProxyConnectException(string message, HttpHeaders headers)
: base(message)
{
this.Headers = headers;
}

/// <summary>
/// Returns headers, if any. May be {@code null}.
/// </summary>
public HttpHeaders Headers { get; }
}
}
Loading