2using System.Threading.Tasks;
57 string Key = State.
Request.RemoteEndPoint.RemovePortNumber() +
"|Count";
62 if (State.TryGetCachedObject(Key, out RateCounter Counter))
63 Counter.Count += Delta;
68 Counter =
new RateCounter()
76 Count = Counter.Count;
79 return await this.
Review(State, Count);
82 private class RateCounter
84 public long Count = 0;
Durationing point (Duration) attribute
Represents a named semaphore, i.e. an object, identified by a name, that allows single concurrent wri...
Static class of application-wide semaphores that can be used to order access to editable objects.
static async Task< Semaphore > BeginWrite(string Key)
Waits until the semaphore identified by Key is ready for writing. Each call to BeginWrite must be fo...
Abstract base class for limit comparisons.
async Task< WafResult?> Review(ProcessingState State, long Value)
Reviews the processing state, and returns a WAF result, if any.
Abstract base class for rate limit comparisons.
RateLimitComparison(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Abstract base class for rate limit comparisons.
Task< Duration > EvaluateDurationAsync(ProcessingState State)
Evaluates the duration of the rate limit.
RateLimitComparison()
Abstract base class for rate limit comparisons.
async Task< WafResult?> ReviewIncrement(ProcessingState State, long Delta)
Reviews the processing state, and returns a WAF result, if any.
Contains the current state of a review process.
Variables Variables
Set of variables.
void AddToCache(string Key, object Value)
Adds a value to the cache.
HttpRequest Request
Current HTTP Request
Abstract base class for Web Application Firewall actions.
WebApplicationFirewall Document
Web Application Firewall document.
Web Application Firewall for HttpServer.
Represents a duration value, as defined by the xsd:duration data type: http://www....
static readonly Duration Zero
Zero value