Exemplo n.º 1
0
        public HTTPHeaderItem Add(string sHeaderName, string sValue)
        {
            HTTPHeaderItem item = new HTTPHeaderItem(sHeaderName, sValue);

            this.storage.Add(item);
            return(item);
        }
Exemplo n.º 2
0
        internal static bool ParseNVPHeaders(HTTPHeaders oHeaders, string[] sHeaderLines, int iStartAt, ref string sErrors)
        {
            bool           flag  = true;
            int            index = iStartAt;
            HTTPHeaderItem item  = null;

            while (index < sHeaderLines.Length)
            {
                int length = sHeaderLines[index].IndexOf(':');
                if (length > 0)
                {
                    item = oHeaders.Add(sHeaderLines[index].Substring(0, length), sHeaderLines[index].Substring(length + 1).Trim());
                }
                else if (length == 0)
                {
                    item    = null;
                    sErrors = sErrors + string.Format("Missing Header name #{0}, {1}\n", (1 + index) - iStartAt, sHeaderLines[index]);
                    flag    = false;
                }
                else
                {
                    item    = oHeaders.Add(sHeaderLines[index], string.Empty);
                    sErrors = sErrors + string.Format("Missing colon in header #{0}, {1}\n", (1 + index) - iStartAt, sHeaderLines[index]);
                    flag    = false;
                }
                index++;
                for (bool flag2 = ((item != null) && (index < sHeaderLines.Length)) && IsPrefixedWithWhitespace(sHeaderLines[index]); flag2; flag2 = (index < sHeaderLines.Length) && IsPrefixedWithWhitespace(sHeaderLines[index]))
                {
                    //SDVPApplication.Log.LogString("[HTTPWarning] Header folding detected. Not all clients properly handle folded headers.");
                    item.Value = (item.Value + " " + sHeaderLines[index].TrimStart(new char[0])).Trim();
                    index++;
                }
            }
            return(flag);
        }
Exemplo n.º 3
0
 public void Remove(HTTPHeaderItem oRemove)
 {
     this.storage.Remove(oRemove);
 }