3using System.Threading.Tasks;
57 string Endpoint = State.
Request.RemoteEndPoint;
58 string Key = Endpoint.RemovePortNumber() +
"|Connections";
63 if (State.TryGetCachedObject(Key, out Dictionary<string, bool> Connections))
64 Connections[Endpoint] =
true;
69 Connections =
new Dictionary<string, bool>()
77 Count = Connections.Count;
80 return await this.
Review(State, Count);
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...
Checks if the remote endpoint has made too many connections.
override string LocalName
XML Local Name for the XML element defining the action.
override WafAction Create(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Creates a WAF action from its XML definition.
ConnectionsExceeded(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Checks if the remote endpoint has made too many connections.
ConnectionsExceeded()
Checks if the remote endpoint has made too many connections.
override async Task< WafResult?> Review(ProcessingState State)
Reviews the processing state, and returns a WAF result, if any.
Abstract base class for rate limit comparisons.
Task< Duration > EvaluateDurationAsync(ProcessingState State)
Evaluates the duration of the rate limit.
Contains the current state of a review process.
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....