HTTP服务器软件系统的设计与实现(13)
时间:2017-02-21 13:09 来源:毕业论文 作者:毕业论文 点击:次
/// 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; (责任编辑:qin) |