// /** // * File: HTTP.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using System.IO; using System.Collections.Generic; using ln.http.exceptions; namespace ln.http.message.parser { public static class HTTP { public static HeaderContainer ReadHeader(TextReader reader) { List headerLines = new List(); string currentline = reader.ReadLine(); while (!currentline.Equals(string.Empty)) { if (char.IsWhiteSpace(currentline[0])) throw new BadRequestException(); headerLines.Add(currentline.Trim()); currentline = reader.ReadLine(); } HeaderContainer headerContainer = new HeaderContainer(); foreach (string headerLine in headerLines) headerContainer.Add(new Header(headerLine)); return headerContainer; } } }