protected internal HttpRequest(HttpListenerRequest request) { Request = request; PathInfo = RawUrl.Split(new[] { '?' }, 2)[0]; Name = $"{HttpMethod} {PathInfo}"; Id = Guid.NewGuid().Truncate(); Advanced = new AdvancedHttpRequest(request); /*ContentEncoding = request.ContentEncoding; * if (request.ContentType == null) * { * ContentEncoding = Encoding.UTF8; * }*/ ContentEncoding = Encoding.UTF8; try { int index = request?.RawUrl?.IndexOf("?") ?? -1; if (index >= 0) { QueryString = HttpUtility.ParseQueryString(Request.RawUrl.Substring(index + 1), ContentEncoding); } } catch { QueryString = request.QueryString; } }
protected internal HttpRequest(HttpListenerRequest request) { Request = request; PathInfo = request.Url.AbsolutePath.TrimEnd('/'); Name = $"{HttpMethod} {PathInfo}"; Id = Guid.NewGuid().Truncate(); Advanced = new AdvancedHttpRequest(request); }
protected internal HttpRequest(Mono.Net.HttpListenerRequest request) { Request = request; PathInfo = RawUrl.Split(new[] { '?' }, 2)[0]; Name = $"{HttpMethod} {PathInfo}"; Id = Guid.NewGuid().Truncate(); Advanced = new AdvancedHttpRequest(request); }
protected internal HttpRequest(HttpListenerRequest request) { Request = request; HttpMethod = (HttpMethod)Enum.Parse(typeof(HttpMethod), Request.HttpMethod); PathInfo = RawUrl.Split(new[] { '?' }, 2)[0]; Name = $"{HttpMethod} {PathInfo}"; Id = Guid.NewGuid().Truncate(); Advanced = new AdvancedHttpRequest(request); }