/// <summary> /// Parses a string in the format 'Method SP Request-Uri SP Http-Version CRLF' into an HttpRequestLine instance /// </summary> /// <param name="value">The string to parse. May contain CRLF.</param> /// <returns></returns> public static HttpRequestLine Parse(string value) { string[] parts = value.Split(' '); HttpProtocolVersion protocolVersion = HttpProtocolVersion.Parse(parts[2]); return(new HttpRequestLine(parts[0], parts[1], protocolVersion)); }
/// <summary> /// Parses a string in the format 'HTTP-Version SP Status-Code SP Reason-Phrase CRLF' into an HttpStatusLine instance /// </summary> /// <example> /// HTTP/1.1 200 OK\r\n /// </example> /// <param name="value">The string to parse. May contain CRLF.</param> /// <returns></returns> public static HttpStatusLine Parse(string value) { int firstSpace = value.IndexOf(HttpControlChars.SP, 0); string a = value.Substring(0, firstSpace); string b = value.Substring(++firstSpace); HttpProtocolVersion protocolVersion = HttpProtocolVersion.Parse(a); HttpStatus status = HttpStatus.Parse(b); return(new HttpStatusLine(protocolVersion, status)); }