public PowerLineContext(HttpListenerContext context, int pathIndex, string[] path, Uri requestUrl) { this.LocalAddress = context.Request.LocalEndPoint.Address.ToString(); this.LocalPort = context.Request.LocalEndPoint.Port; this.RemoteAddress = context.Request.RemoteEndPoint.Address.ToString(); this.RemotePort = context.Request.RemoteEndPoint.Port; this.ReqeustUri = requestUrl; this.RequestedUriQuary = new PowerLineUriArgumentParser(this.ReqeustUri); this.IsWebSocket = false; this.context = context; this.request = context.Request; this.response = context.Response; this.RequestMethod = this.request.HttpMethod; this.PathIndex = pathIndex; this.Path = path; this.RequestHeaders = new Dictionary <string, string>(this.request.Headers.AllKeys.Select((headerKey) => new KeyValuePair <string, string>(headerKey, this.request.Headers.Get(headerKey)))); this.ResponseHeader = new Dictionary <string, string>(this.request.Headers.AllKeys.Select((headerKey) => new KeyValuePair <string, string>(headerKey, this.request.Headers.Get(headerKey)))); this.RequestPayload = (this.request.HasEntityBody) ? this.request.InputStream : null; this.ResponsePayload = null; }
public PowerLineUriArgumentParser(Uri url) { this.Url = url; this.Arguemnts = PowerLineUriArgumentParser.ParseUrl(url); }