-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da37622
commit 2fe53f0
Showing
12 changed files
with
110 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// The Sisk Framework source code | ||
// Copyright (c) 2023 PROJECT PRINCIPIUM | ||
// | ||
// The code below is licensed under the MIT license as | ||
// of the date of its publication, available at | ||
// | ||
// File name: ForwardingResolver.cs | ||
// Repository: https://github.com/sisk-http/core | ||
|
||
using System.Net; | ||
|
||
namespace Sisk.Core.Http; | ||
|
||
/// <summary> | ||
/// Provides HTTP forwarding resolving methods that can be used to resolving the client remote | ||
/// address, host and protocol of a proxy, load balancer or CDN, through the HTTP request. | ||
/// </summary> | ||
public class ForwardingResolver | ||
{ | ||
/// <summary> | ||
/// Method that is called when resolving the IP address of the client in the request. | ||
/// </summary> | ||
/// <param name="request">The <see cref="HttpRequest"/> object which contains parameters of the request.</param> | ||
/// <param name="connectingEndpoint">The original connecting endpoint.</param> | ||
/// <returns></returns> | ||
public virtual IPAddress OnResolveClientAddress(HttpRequest request, IPEndPoint connectingEndpoint) | ||
{ | ||
return connectingEndpoint.Address; | ||
} | ||
|
||
/// <summary> | ||
/// Method that is called when resolving the client request host. | ||
/// </summary> | ||
/// <param name="request">The <see cref="HttpRequest"/> object which contains parameters of the request.</param> | ||
/// <param name="requestedHost">The original requested host.</param> | ||
/// <returns></returns> | ||
public virtual string OnResolveRequestHost(HttpRequest request, string requestedHost) | ||
{ | ||
return requestedHost; | ||
} | ||
|
||
/// <summary> | ||
/// Method that is called when resolving whether the HTTP request is using HTTPS or HTTP. | ||
/// </summary> | ||
/// <param name="request">The <see cref="HttpRequest"/> object which contains parameters of the request.</param> | ||
/// <param name="isSecure">The original security state of the request.</param> | ||
/// <returns></returns> | ||
public virtual bool OnResolveSecureConnection(HttpRequest request, bool isSecure) | ||
{ | ||
return isSecure; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters