Пример #1
0
 void InitiateParameters()
 {
     this.query   = new QueryParameters(this);
     this.body    = new BodyParameters(this);
     this.cookie  = new CookieParameters(this);
     this.headers = new RequestHeaderParameters(this);
 }
Пример #2
0
 internal void SetCookie(string CookieString)
 {
     this.FreezeCookieString = true;
     this.SetCookieWithoutUpdatingParameters(CookieString);
     this.cookie             = new CookieParameters(this, CookieString);
     this.FreezeCookieString = false;
 }
Пример #3
0
        public static string GetResponseTriggerHighlighting(string Trigg, Response Res)
        {
            StringBuilder SB        = new StringBuilder();
            string        ResHeader = Res.GetHeadersAsString();
            string        ResBody   = Res.BodyString;

            List <string> AllTriggerVariations = new List <string>();

            AllTriggerVariations.Add(Trigg);
            if (!AllTriggerVariations.Contains(CookieParameters.Encode(Trigg)))
            {
                AllTriggerVariations.Add(CookieParameters.Encode(Trigg));
            }
            if (!AllTriggerVariations.Contains(HeaderParameters.Encode(Trigg)))
            {
                AllTriggerVariations.Add(HeaderParameters.Encode(Trigg));
            }

            try
            {
                List <string> HeaderAdjustments = GetHeaderVariations(Trigg, Res.Headers, ResHeader);
                foreach (string HA in HeaderAdjustments)
                {
                    if (!AllTriggerVariations.Contains(HA))
                    {
                        AllTriggerVariations.Add(HA);
                    }
                }
            }
            catch { }

            List <string> HeaderTriggerVariations = new List <string>();

            foreach (string CurrentVariation in AllTriggerVariations)
            {
                if (!HeaderTriggerVariations.Contains(CurrentVariation) && ResHeader.Contains(CurrentVariation))
                {
                    HeaderTriggerVariations.Add(CurrentVariation);
                }
            }
            ResHeader = Highlighter.InsertHighlights(ResHeader, HeaderTriggerVariations);

            ResBody = GetResponseBodyHighlighting(ResBody, Trigg);
            if (!ResHeader.Contains("<i<hlg>>") && !ResBody.Contains("<i<hlg>>"))
            {
                foreach (string TriggLine in Tools.SplitLines(Trigg))
                {
                    ResBody = GetResponseBodyHighlighting(ResBody, TriggLine);
                }
            }

            SB.Append(Highlighter.SnipHeaderSection(ResHeader).TrimEnd());
            SB.AppendLine(); SB.AppendLine();
            SB.Append(Highlighter.SnipBodySection(ResBody));
            return(SB.ToString().Replace("\n", "<i<br>>"));
        }
Пример #4
0
 void InitiateParameters()
 {
     this.query = new QueryParameters(this);
     this.body = new BodyParameters(this);
     this.cookie = new CookieParameters(this);
     this.headers = new RequestHeaderParameters(this);
 }
Пример #5
0
 internal void UpdateCookieParametersWithoutUpdatingHeaders(string CookieString)
 {
     this.FreezeCookieHeader = true;
     this.cookie = new CookieParameters(this, CookieString);
     this.FreezeCookieHeader = false;
 }
Пример #6
0
 internal void SetCookie(string CookieString)
 {
     this.FreezeCookieString = true;
     this.SetCookieWithoutUpdatingParameters(CookieString);
     this.cookie = new CookieParameters(this, CookieString);
     this.FreezeCookieString = false;
 }
Пример #7
0
        public SetCookie(string SetCookieString)
        {
            this.fullString = SetCookieString;
            string[] Parts = this.fullString.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (Parts.Length == 0)
            {
                return;
            }
            int NVE = Parts[0].IndexOf("=");

            if (NVE > 0)
            {
                this.name = CookieParameters.Decode(Parts[0].Substring(0, NVE).Trim());
                if (Parts[0].Length > (NVE + 1))
                {
                    this.value = CookieParameters.Decode(Parts[0].Substring(NVE + 1).Trim());
                }
            }
            for (int i = 1; i < Parts.Length; i++)
            {
                NVE = Parts[i].IndexOf("=");
                if (NVE > 0)
                {
                    string K = Parts[i].Substring(0, NVE).ToLower().Trim();
                    if (Parts[i].Length > (NVE + 1))
                    {
                        string V = Parts[i].Substring(NVE + 1).Trim();
                        if (K.Equals("domain"))
                        {
                            this.domain = V;
                        }
                        else if (K.Equals("path"))
                        {
                            this.path = V;
                        }
                        else if (K.Equals("max-age"))
                        {
                            this.maxAge = V;
                        }
                        else if (K.Equals("expires"))
                        {
                            this.expires = V;
                        }
                        else if (K.Equals("comment"))
                        {
                            this.comment = V;
                        }
                        else if (K.Equals("version"))
                        {
                            this.version = V;
                        }
                    }
                }
                else
                {
                    string Part = Parts[i].ToLower().Trim();
                    if (Part.Equals("httponly"))
                    {
                        this.httpOnly = true;
                    }
                    else if (Part.Equals("secure"))
                    {
                        this.secure = true;
                    }
                }
                this.attributes.Add(Parts[i]);
            }
        }
Пример #8
0
 internal void UpdateCookieParametersWithoutUpdatingHeaders(string CookieString)
 {
     this.FreezeCookieHeader = true;
     this.cookie             = new CookieParameters(this, CookieString);
     this.FreezeCookieHeader = false;
 }