titanium-web-proxy icon indicating copy to clipboard operation
titanium-web-proxy copied to clipboard

Limit Sessions Per Client

Open korolossamy opened this issue 3 years ago • 0 comments

Hi Team,

I would Like to Limit 100 Sessions or Threads per Each Client connect to Proxy server What i have tried on below but still not limited

`
private async Task ProxyServer_BeforeRequest(object sender, SessionEventArgs e) { if (ClientConnectionCount <= 100) {

        SessionListItem item = null;
            await Dispatcher.InvokeAsync(() => { item = addSession(e); });

            if (e.HttpClient.Request.HasBody)
            {
                e.HttpClient.Request.KeepBody = true;
                await e.GetRequestBody();

                if (item == SelectedSession)
                {
                    await Dispatcher.InvokeAsync(selectedSessionChanged);
                }
            }
        }
        else
        {
            var res = new Response();
            res.StatusCode = 400;
            res.StatusDescription = "Limit Exceeded";
            e.Respond(res, true);
    
        }
    }`

korolossamy avatar Jul 20 '22 06:07 korolossamy