public void ParseBody(SiteCatalystRequest request, Session session)
 {
     if (session.oRequest.headers.HTTPMethod == "POST" &&
         session.responseBodyBytes != null &&
         session.responseBodyBytes.Length > 0)
     {
         _bodyParser.ParseValues(Encoding.UTF8.GetString(session.responseBodyBytes));
         SetSharedRequestValues(request, _bodyParser);
     }
 }
        public SiteCatalystRequest ParseRequest(Session session)
        {
            SiteCatalystRequest request = new SiteCatalystRequest();

            request.Id = session.id;
            request.FiddlerHost = Environment.MachineName.ToLower();
            request.Host = (session.host ?? string.Empty).ToLower();
            request.ResponseServer = session.oResponse["server"] ?? string.Empty;

            if (IsValidSiteCatalystRequest(request))
            {
                request.RawUrl = session.fullUrl;
                request.RawBody = Encoding.UTF8.GetString(session.responseBodyBytes);

                ParseQueryString(request, session.fullUrl);
                ParseBody(request, session);

                return request;
            }

            return null;
        }
        private void SetSharedRequestValues(SiteCatalystRequest request, ValueParser parser)
        {
            if (parser.Values != null && parser.Values.Count > 0)
            {
                request.RequestingUrl = _queryParser.GetValueIfExists("g");
                request.ReferringUrl = _queryParser.GetValueIfExists("r");

                request.Channel = _queryParser.GetValueIfExists("ch");
                request.PageName = _queryParser.GetValueIfExists("pageName");
                request.Account = _queryParser.GetValueIfExists("account");
                request.Events = _queryParser.GetValueIfExists("events");

                DateTime time = DateTime.MinValue;
                DateTime.TryParse(_queryParser.GetValueIfExists("t"), out time);
                request.Time = time;

                SetSiteCatalystRequestValues(parser, request.Props, "c", "prop");
                SetSiteCatalystRequestValues(parser, request.Props, "v", "eVar");
            }
        }
        private bool IsValidSiteCatalystRequest(SiteCatalystRequest request)
        {
            string host = (request.Host ?? string.Empty).ToLowerInvariant();
            string server = (request.ResponseServer ?? string.Empty).ToLowerInvariant();

            return (!IsFilteredHost(host) && server.Contains("omniture") );
        }
 public void ParseQueryString(SiteCatalystRequest request, string url)
 {
     _queryParser.ParseValues(url);
     SetSharedRequestValues(request, _queryParser);
 }