Ejemplo n.º 1
0
        /// <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));
        }