//public override int OnSend(Session session, object data) //{ // int result = base.OnSend(session, data); // m_WebSocketServer.Logger.Info("On Send - " + data.ToString()); // return result; //} protected override void ProcessMessage(SessionContext ctx) { if (ctx == null) { return; } HttpMessage msg = ctx.Data as HttpMessage; if (msg == null || !msg.IsString()) { ctx.Session.Close(); return; } else { string content = msg.RequestUrl; if ((m_SimpleHttpServer.Flags & RequestContext.FLAG_PUBLIC) != 0 && (m_SimpleHttpServer.Flags & RequestContext.FLAG_ALLOW_PARENT_PATH) != 0) { var usefulPath = new List <string>(); var parts = content.Split('/'); for (int i = parts.Length - 1; i >= 0; i--) { var part = parts[i].Trim(); if (part.Length > 0) { usefulPath.Add(part); } if (usefulPath.Count >= 2) { content = "/" + usefulPath[1] + "/" + usefulPath[0]; break; } } } content += (content.EndsWith("/") ? "" : "/") + msg.MessageContent; var reqctx = new RequestContext(new SimpleHttpSession(ctx.Session), content, m_SimpleHttpServer.Flags); reqctx.RequestPath = msg.RequestUrl; reqctx.Headers = new Dictionary <string, string>(msg.Headers); m_SimpleHttpServer.RequestHandler.HandleRequest(reqctx); } }