Esempio n. 1
0
        private void FireRequestCallback(IHttpClientContext client, IHttpRequest request, IHttpResponse response, HttpRequestHandler handler)
        {
            try
            {
                handler.Callback(client, request, response);
            }
            catch (Exception ex)
            {
                m_log.Error("Exception in HTTP handler: " + ex);
                response.Status = HttpStatusCode.InternalServerError;
                response.Send();
            }

            if (handler.SendResponseAfterCallback && !response.Sent)
            {
                try { response.Send(); }
                catch (Exception ex) { m_log.ErrorFormat("Failed to send HTTP response for request to {0}: {1}", request.Uri, ex.Message); }
            }

            request.Clear();
        }
Esempio n. 2
0
 public void Send404Response(IHttpClientContext context, IHttpRequest request, IHttpResponse response)
 {
     m_notFoundHandler.Callback(context, request, response);
 }