public void AddRequest(TrackedRequest request) { IAsyncResult a = null; a = BeginInvoke((Action)(() => { var asyncResult = a; if (asyncResult != null) { EndInvoke(asyncResult); } var url = request.Url; var startsIndex = url.IndexOf("&start="); if (startsIndex != -1) url = url.Substring(0, startsIndex); RequestsLists.Items.Add(new ListViewItem(new[] { request.Method, request.Status.ToString(), HttpUtility.UrlDecode(HttpUtility.UrlDecode(url)) }) { Tag = request }); })); }
public void AddRequest(TrackedRequest request) { IAsyncResult a = null; a = BeginInvoke((Action)(() => { var asyncResult = a; if (asyncResult != null) { EndInvoke(asyncResult); } var url = request.Url; var startsIndex = url.IndexOf("&start="); if (startsIndex != -1) { url = url.Substring(0, startsIndex); } RequestsLists.Items.Add(new ListViewItem(new[] { request.Method, request.Status.ToString(), HttpUtility.UrlDecode(HttpUtility.UrlDecode(url)) }) { Tag = request }); })); }
private Action AdaptHttpContext(IHttpContext httpContext, ServerLog serverLog) { if (pathsToFilter.Contains(httpContext.Request.Url.AbsolutePath)) return null; if (ignoreHilo && httpContext.Request.Url.AbsolutePath.StartsWith("/docs/Raven/Hilo/")) return null; if (httpContext.Request.Headers["Raven-Timer-Request"] != null) return null; var requestStream = new MemoryStream(); httpContext.SetRequestFilter(stream => { stream.CopyTo(requestStream); return new MemoryStream(requestStream.ToArray()); }); var responseStream = new MemoryStream(); httpContext.SetResponseFilter(stream => new MultiStreamWriter(responseStream, stream)); var trackedRequest = new TrackedRequest { Method = httpContext.Request.HttpMethod, Url = httpContext.Request.RawUrl, RequestHeaders = new NameValueCollection(httpContext.Request.Headers), RequestContent = requestStream, ResponseContent = responseStream, ResponseHeaders = httpContext.Response.GetHeaders(), }; return () => { trackedRequest.Status = httpContext.Response.StatusCode; serverLog.AddRequest(trackedRequest); }; }
private string GetRequestText(TrackedRequest trackedRequest) { var requestStringBuilder = new StringBuilder(); //AppendHeaders(trackedRequest.RequestHeaders, requestStringBuilder); requestStringBuilder.AppendLine(); WriteStreamContentMaybeJson(requestStringBuilder, trackedRequest.RequestContent, trackedRequest.RequestHeaders); return requestStringBuilder.ToString(); }
private string GetRequestText(TrackedRequest trackedRequest) { var requestStringBuilder = new StringBuilder(); //AppendHeaders(trackedRequest.RequestHeaders, requestStringBuilder); requestStringBuilder.AppendLine(); WriteStreamContentMaybeJson(requestStringBuilder, trackedRequest.RequestContent, trackedRequest.RequestHeaders); return(requestStringBuilder.ToString()); }
private Action AdaptHttpContext(IHttpContext httpContext, ServerLog serverLog) { if (pathsToFilter.Contains(httpContext.Request.Url.AbsolutePath)) { return(null); } if (ignoreHilo && httpContext.Request.Url.AbsolutePath.StartsWith("/docs/Raven/Hilo/")) { return(null); } if (httpContext.Request.Headers["Raven-Timer-Request"] != null) { return(null); } var requestStream = new MemoryStream(); httpContext.SetRequestFilter(stream => { stream.CopyTo(requestStream); return(new MemoryStream(requestStream.ToArray())); }); var responseStream = new MemoryStream(); httpContext.SetResponseFilter(stream => new MultiStreamWriter(responseStream, stream)); var trackedRequest = new TrackedRequest { Method = httpContext.Request.HttpMethod, Url = httpContext.Request.RawUrl, RequestHeaders = new NameValueCollection(httpContext.Request.Headers), RequestContent = requestStream, ResponseContent = responseStream, ResponseHeaders = httpContext.Response.GetHeaders(), }; return(() => { trackedRequest.Status = httpContext.Response.StatusCode; serverLog.AddRequest(trackedRequest); }); }