예제 #1
0
        /// <summary>
        ///  将流中的一行,解析成Header
        /// </summary>
        /// <param name="data"></param>
        /// <param name="len"></param>
        /// <returns></returns>
        private static HttpInfo.Header ToHeader(MemoryStream data, int len)
        {
            var line = Encoding.Default.GetString(data.ToArray(), 0, len);

            HttpInfo.Header header = null;
            var             pars   = line.Split(new String[] { ": " }, StringSplitOptions.RemoveEmptyEntries);

            if (pars.Length == 2)
            {
                header = new HttpInfo.Header()
                {
                    Name = pars[0], Value = pars[1]
                };
            }
            return(header);
        }
예제 #2
0
 /// <summary>
 ///  将流中的一行,解析成Header
 /// </summary>
 /// <param name="data"></param>
 /// <param name="len"></param>
 /// <returns></returns>
 private static HttpInfo.Header ToHeader(MemoryStream data, int len)
 {
     var line = Encoding.Default.GetString(data.ToArray(), 0, len);
     HttpInfo.Header header = null;
     var pars = line.Split(new String[] { ": " }, StringSplitOptions.RemoveEmptyEntries);
     if (pars.Length == 2)
     {
         header = new HttpInfo.Header() { Name = pars[0], Value = pars[1] };
     }
     return header;
 }