internal HttpStatusLine(HttpSocket hs)
{
string line;
do
line = hs.ReadAsciiLine().Trim();
while (line.Length == 0);
string[] items = line.Split(sp,
StringSplitOptions.RemoveEmptyEntries);
// Note: the status line has three items: the HTTP protocol
// version, the status code, and the reason phrase.
// Only the reason phrase may be empty.
if (items.Length < 2)
throw new HttpProtocolBroken("Unrecognized status line '" +
line + "'");
ProtocolVersion = ParserHelper.ParseProtocolVersion(
items[0]);
string code = items[1];
if (code.Length != 3 ||
!char.IsDigit(code[0])) // we only test the first character
throw new HttpProtocolBroken("Invalid status code '" +
code + "'");
//string Reason = rest of the string; // we don't need it
StatusCode = int.Parse(code);
StatusLine = line;
}