Make the hold method configurable in the dashboard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a56fc5b48
commit
6b9bf3cd5f
40 files changed
+815
-134
No files matched your search
@@ -39,7 +39,7 @@ internal sealed class FlypaperMiddleware(
|
||||
|
||||
var outcome = await runner.RunAsync(
|
||||
trapContext,
|
||||
ct => OpenChannelAsync(context, session, ct),
|
||||
(strategy, ct) => OpenChannelAsync(context, session, strategy, ct),
|
||||
context.RequestAborted);
|
||||
|
||||
if (outcome == TrapOutcome.Rejected && !context.Response.HasStarted)
|
||||
@@ -59,6 +59,7 @@ internal sealed class FlypaperMiddleware(
|
||||
private static async ValueTask<ITrapChannel> OpenChannelAsync(
|
||||
HttpContext context,
|
||||
TrapSession session,
|
||||
ITarpitStrategy strategy,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var minDataRate = context.Features.Get<IHttpMinResponseDataRateFeature>();
|
||||
@@ -71,7 +72,7 @@ internal sealed class FlypaperMiddleware(
|
||||
|
||||
var response = context.Response;
|
||||
response.StatusCode = StatusCodes.Status200OK;
|
||||
response.ContentType = "text/html; charset=utf-8";
|
||||
response.ContentType = strategy is IStrategyDetails details ? details.MediaType : "text/html; charset=utf-8";
|
||||
response.Headers.CacheControl = "no-store";
|
||||
response.Headers["X-Accel-Buffering"] = "no";
|
||||
await response.StartAsync(ct);
|
||||
|
||||
Reference in new issue
Block a user