private void AddHeaderToRequest(HttpRequest request, string headerLine) { var hp = headerLine.Split(new[] { ':' }, 2); var hn = hp[0].Trim(); var hv = hp.Length == 2 ? hp[1].Trim() : string.Empty; request.AddHeader(hn, hv); }
private HttpRequest CreateRequest(string firstRequestLine) { var firstRequestLineParts = firstRequestLine.Split(' '); if (firstRequestLineParts.Length != 3) { throw new ParserException( "Invalid format for the first request line. Expected format: [Method] [Uri] HTTP/[Version]"); } var requestObject = new HttpRequest(firstRequestLineParts[0], firstRequestLineParts[1], firstRequestLineParts[2]); return requestObject; }