示例#1
0
        /// <summary>
        /// The fiddler application before response.
        /// </summary>
        /// <param name="session">
        /// The session.
        /// </param>
        private void FiddlerApplicationBeforeResponse(Session session)
        {
            var requestProperties = new RequestProperties(session.fullUrl, session.oRequest.headers["Referer"], session.oRequest.headers["Accept"]);

            var filteredRules = from r in this.ResponseRules where r.Enabled where r.Matches == null || UriPattern.Match(requestProperties, r.Matches) select r;

            (from rule in filteredRules let rule1 = rule where rule.ResponseActions.Any(action => action.Enabled && !action.OnResponse(session, rule1)) select rule).Any();

            if (this.ResponseReceived != null)
            {
                this.ResponseReceived(
                    session, new ResponseSummaryEventArgs {
                    ResponseCode = session.responseCode, FullUrl = session.fullUrl, ResponseCodeText = session.oResponse.headers.HTTPResponseStatus, Referer = (session.oRequest["Referer"].HasValue() ? session.oRequest["Referer"] : "None") + ", Sessions: " + this.SessionCount, Length = session.ResponseBody.LongLength
                });
            }
        }
示例#2
0
        /// <summary>
        /// The fiddler application before request.
        /// </summary>
        /// <param name="session">
        /// The session.
        /// </param>
        private void FiddlerApplicationBeforeRequest(Session session)
        {
            Interlocked.Increment(ref this._sessionCount);

            var requestProperties = new RequestProperties(session.fullUrl, session.oRequest.headers["Referer"], session.oRequest.headers["Accept"]);

            if (requestProperties.Uri == null)
            {
                // Malformed URI, let's terminate the request.
                session.oRequest.FailSession(400, "Bad Request (Malformed Uri)", String.Empty);
                return;
            }

            var filteredRules = from r in this.RequestRules where r.Enabled where r.Matches == null || UriPattern.Match(requestProperties, r.Matches) select r;

            foreach (var rule in filteredRules.Where(rule => rule.RequestActions.Any(action => action.Enabled && !action.BeforeRequest(session, rule))))
            {
                break;
            }
        }