aboutsummaryrefslogtreecommitdiff
path: root/lib/Plugins.Essentials/src
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-09-22 12:29:32 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-09-22 12:29:32 -0400
commit04c8fa8017a04da05cd8e1d104cfcd0a9aba17f5 (patch)
tree771243c218e880346fc7d826fa25ac2d639b01be /lib/Plugins.Essentials/src
parent0b4e18b9a7d8e0aea23aef7efd3707674f223b2b (diff)
Structure refactor & unused feature pruning, more http2 prep
Diffstat (limited to 'lib/Plugins.Essentials/src')
-rw-r--r--lib/Plugins.Essentials/src/EventProcessor.cs19
-rw-r--r--lib/Plugins.Essentials/src/IEpProcessingOptions.cs14
-rw-r--r--lib/Plugins.Essentials/src/Middleware/IHttpMiddleware.cs2
3 files changed, 17 insertions, 18 deletions
diff --git a/lib/Plugins.Essentials/src/EventProcessor.cs b/lib/Plugins.Essentials/src/EventProcessor.cs
index c4659b9..a9cd98a 100644
--- a/lib/Plugins.Essentials/src/EventProcessor.cs
+++ b/lib/Plugins.Essentials/src/EventProcessor.cs
@@ -73,9 +73,6 @@ namespace VNLib.Plugins.Essentials
/// </summary>
public abstract IEpProcessingOptions Options { get; }
- ///<inheritdoc/>
- public abstract IReadOnlyDictionary<string, Redirect> Redirects { get; }
-
/// <summary>
/// Event log provider
/// </summary>
@@ -222,18 +219,18 @@ namespace VNLib.Plugins.Essentials
while(mwNode != null)
{
//Process
- HttpMiddlewareResult result = await mwNode.ValueRef.ProcessAsync(entity);
+ args = await mwNode.ValueRef.ProcessAsync(entity);
- switch (result)
+ switch (args.Routine)
{
- //move next
- case HttpMiddlewareResult.Continue:
+ //move next if continue is returned
+ case FpRoutine.Continue:
mwNode = mwNode.Next;
break;
//Middleware completed the connection, time to exit
- case HttpMiddlewareResult.Complete:
- return;
+ default:
+ goto MwExit;
}
}
@@ -259,7 +256,7 @@ namespace VNLib.Plugins.Essentials
ProcessFile(httpEvent, in args);
return;
}
- }
+ }
//If no virtual processor handled the ws request, deny it
if (entity.Server.IsWebSocketRequest)
@@ -271,6 +268,8 @@ namespace VNLib.Plugins.Essentials
//Finally process as file
args = await RouteFileAsync(entity);
+ MwExit:
+
//Finally process the file
ProcessFile(httpEvent, in args);
}
diff --git a/lib/Plugins.Essentials/src/IEpProcessingOptions.cs b/lib/Plugins.Essentials/src/IEpProcessingOptions.cs
index 13dcd37..b9efdeb 100644
--- a/lib/Plugins.Essentials/src/IEpProcessingOptions.cs
+++ b/lib/Plugins.Essentials/src/IEpProcessingOptions.cs
@@ -27,8 +27,6 @@ using System.IO;
using System.Net;
using System.Collections.Generic;
-using VNLib.Net.Http;
-
#nullable enable
namespace VNLib.Plugins.Essentials
@@ -39,34 +37,36 @@ namespace VNLib.Plugins.Essentials
/// </summary>
public interface IEpProcessingOptions
{
+
/// <summary>
/// The name of a default file to search for within a directory if no file is specified (index.html).
/// This array should be ordered.
/// </summary>
IReadOnlyCollection<string> DefaultFiles { get; }
+
/// <summary>
/// File extensions that are denied from being read from the filesystem
/// </summary>
IReadOnlySet<string> ExcludedExtensions { get; }
+
/// <summary>
/// File attributes that must be matched for the file to be accessed
/// </summary>
FileAttributes AllowedAttributes { get; }
+
/// <summary>
/// Files that match any attribute flag set will be denied
/// </summary>
- FileAttributes DissallowedAttributes { get; }
+ FileAttributes DissallowedAttributes { get; }
+
/// <summary>
/// A table of known downstream servers/ports that can be trusted to proxy connections
/// </summary>
IReadOnlySet<IPAddress> DownStreamServers { get; }
+
/// <summary>
/// A <see cref="TimeSpan"/> for how long a connection may remain open before all operations are cancelled
/// </summary>
TimeSpan ExecutionTimeout { get; }
- /// <summary>
- /// HTTP level "hard" 301 redirects
- /// </summary>
- IReadOnlyDictionary<string, Redirect> HardRedirects { get; }
}
} \ No newline at end of file
diff --git a/lib/Plugins.Essentials/src/Middleware/IHttpMiddleware.cs b/lib/Plugins.Essentials/src/Middleware/IHttpMiddleware.cs
index a5a3949..4485c55 100644
--- a/lib/Plugins.Essentials/src/Middleware/IHttpMiddleware.cs
+++ b/lib/Plugins.Essentials/src/Middleware/IHttpMiddleware.cs
@@ -39,6 +39,6 @@ namespace VNLib.Plugins.Essentials.Middleware
/// </summary>
/// <param name="entity">The entity to process</param>
/// <returns>The result of the operation</returns>
- ValueTask<HttpMiddlewareResult> ProcessAsync(HttpEntity entity);
+ ValueTask<FileProcessArgs> ProcessAsync(HttpEntity entity);
}
}