Пример #1
0
        public void HeaderWriting(HttpRequest request, HttpResponse response, Header header)
        {
            var items = mHeaderWritingHandlers;

            if (items.Length > 0)
            {
                Events.EventHeaderWritingArgs e = new Events.EventHeaderWritingArgs(request, response, Gateway, header);
                for (int i = 0; i < items.Length; i++)
                {
                    items[i].Execute(e);
                }
            }
        }
Пример #2
0
        public void HeaderWriting(HttpRequest request, HttpResponse response, Header header)
        {
            var items = mHeaderWritingHandlers;

            if (items.Length > 0)
            {
                Events.EventHeaderWritingArgs e = new Events.EventHeaderWritingArgs(request, response, Gateway, header);
                for (int i = 0; i < items.Length; i++)
                {
                    if (Gateway.PluginCenter.PluginIsEnabled(items[i]))
                    {
                        try
                        {
                            items[i].Execute(e);
                        }
                        catch (Exception e_)
                        {
                            Gateway.HttpServer.GetLog(LogType.Error)?
                            .Log(LogType.Error, $"gateway {request.ID} {request.RemoteIPAddress} {request.Method} {request.GetSourceUrl()} {items[i].Name} header writing plugin process error {e_.Message}@{e_.StackTrace}");
                        }
                    }
                }
            }
        }