44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
// /**
|
|
// * File: MIME.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;
|
|
namespace ln.http.message.parser
|
|
{
|
|
public static class MIME
|
|
{
|
|
public static HeaderContainer ReadHeader(TextReader reader)
|
|
{
|
|
List<String> headerLines = new List<string>();
|
|
string currentline = reader.ReadLine();
|
|
while (!currentline.Equals(string.Empty))
|
|
{
|
|
if (char.IsWhiteSpace(currentline[0]))
|
|
{
|
|
headerLines[headerLines.Count - 1] = headerLines[headerLines.Count - 1] + currentline;
|
|
}
|
|
else
|
|
{
|
|
headerLines.Add(currentline);
|
|
}
|
|
currentline = reader.ReadLine();
|
|
}
|
|
|
|
HeaderContainer headerContainer = new HeaderContainer();
|
|
|
|
foreach (string headerLine in headerLines)
|
|
headerContainer.Add(new Header(headerLine));
|
|
|
|
return headerContainer;
|
|
}
|
|
|
|
}
|
|
}
|