///
req.CompleteRequest = new String(Encoding.UTF8.GetChars(e.RawData));
string[] groups = req.CompleteRequest.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < groups.Length; i++)
{
string headerblock = groups[i];
if (i > 0 && headerblock.Contains(":"))
{
//从所述第二块,我们也fileds模式<name:value>与
string[] block = headerblock.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
req.Requests.Add(block[0], block[1]);
}
else
{
///
/// 第一个块总是包括请求的路径,方法和协议HTTP。
/// ex. GET /path/resource.ext HTTP/1.1
///
string[] subparts = headerblock.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
//复制路径
req.CompletePath = subparts[1];
if (subparts[0] == "GET") req.Method = HttpMethodType.Get; HTTP服务器软件系统的设计与实现(13):http://www.751com.cn/jisuanji/lunwen_3170.html