private void OnGetContext(object ctx) { if (shutdownInProgress) { return; } try { var context = (HttpListenerContext)ctx; var conn = new Connection(this, context); if (!Thread.CurrentThread.CurrentCulture.Equals(currentThreadCulture)) { Thread.CurrentThread.CurrentCulture = currentThreadCulture; Thread.CurrentThread.CurrentUICulture = currentThreadCulture; } if (conn.WaitForRequestBytes() == 0) { conn.WriteErrorAndClose(400); } else { var host = GetHost(); if (host == null) { conn.WriteErrorAndClose(500); } else { var handlerContext = new HttpHandlerContext(this, host, conn, Thread.CurrentPrincipal.Identity); HttpHandlerFactory.GetHttpHandler(handlerContext) .ProcessRequest(handlerContext); } } } catch (Exception ex) { log.Warn(ServerMessages.ExceptionWhileProcessing, ex); } }
public void ProcessRequest(HttpHandlerContext context) { context.Host.ProcessRequest(context.Connection, context.Identity); }