aboutsummaryrefslogtreecommitdiff
path: root/lib/Plugins.Essentials/src
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-01-21 21:43:21 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-01-21 21:43:21 -0500
commit05ebe3b38342ba38ad0f1c418058d5100ca776ab (patch)
tree42d8b368c7dabc09d8761f3cce7411c8f5b0565f /lib/Plugins.Essentials/src
parent46caaac9debdaad496c07af9d3806e67a447066c (diff)
Fix FBM session cancel, fix plugin log file names
Diffstat (limited to 'lib/Plugins.Essentials/src')
-rw-r--r--lib/Plugins.Essentials/src/Extensions/EssentialHttpEventExtensions.cs7
-rw-r--r--lib/Plugins.Essentials/src/Extensions/RedirectType.cs24
-rw-r--r--lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj1
3 files changed, 31 insertions, 1 deletions
diff --git a/lib/Plugins.Essentials/src/Extensions/EssentialHttpEventExtensions.cs b/lib/Plugins.Essentials/src/Extensions/EssentialHttpEventExtensions.cs
index 9458487..4fd77a6 100644
--- a/lib/Plugins.Essentials/src/Extensions/EssentialHttpEventExtensions.cs
+++ b/lib/Plugins.Essentials/src/Extensions/EssentialHttpEventExtensions.cs
@@ -428,9 +428,16 @@ namespace VNLib.Plugins.Essentials.Extensions
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Redirect(this IHttpEvent ev, RedirectType type, Uri location)
{
+
+ if(type == RedirectType.None)
+ {
+ throw new ArgumentException("Invalid redirect type of none", nameof(type));
+ }
+
//Encode the string for propery http url formatting and set the location header
ev.Server.Headers[HttpResponseHeader.Location] = location.ToString();
ev.Server.SetNoCache();
+
//Set redirect the ressponse redirect code type
ev.CloseResponse((HttpStatusCode)type);
}
diff --git a/lib/Plugins.Essentials/src/Extensions/RedirectType.cs b/lib/Plugins.Essentials/src/Extensions/RedirectType.cs
index eff4d38..4c9f025 100644
--- a/lib/Plugins.Essentials/src/Extensions/RedirectType.cs
+++ b/lib/Plugins.Essentials/src/Extensions/RedirectType.cs
@@ -31,7 +31,29 @@ namespace VNLib.Plugins.Essentials.Extensions
/// </summary>
public enum RedirectType
{
+ /// <summary>
+ /// NOT-USED
+ /// </summary>
None,
- Moved = 301, Found = 302, SeeOther = 303, Temporary = 307, Permanent = 308
+ /// <summary>
+ /// Sets the HTTP 301 response code for a "moved" redirect
+ /// </summary>
+ Moved = 301,
+ /// <summary>
+ /// Sets the HTTP 302 response code for a "Found" redirect
+ /// </summary>
+ Found = 302,
+ /// <summary>
+ /// Sets the HTTP 303 response code for a "SeeOther" redirect
+ /// </summary>
+ SeeOther = 303,
+ /// <summary>
+ /// Sets the HTTP 307 response code for a "Temporary" redirect
+ /// </summary>
+ Temporary = 307,
+ /// <summary>
+ /// Sets the HTTP 308 response code for a "Permanent" redirect
+ /// </summary>
+ Permanent = 308
}
} \ No newline at end of file
diff --git a/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj b/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj
index 8d09067..e6b24aa 100644
--- a/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj
+++ b/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj
@@ -19,6 +19,7 @@
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>\\vaughnnugent.com\Internal\Folder Redirection\vman\Documents\Programming\Software\StrongNameingKey.snk</AssemblyOriginatorKeyFile>
+ <RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>
<!-- Resolve nuget dll files and store them in the output dir -->