public Request(string clientAddress, RequestType type, string path, double version, Dictionary<string, string> headers, bool useRealIP)
{
Type = type;
Path = path;
Version = version;
Headers = headers;
string lengthString;
if (Headers.TryGetValue("Content-Length", out lengthString))
{
try
{
ContentLength = Convert.ToInt32(lengthString);
}
catch (FormatException)
{
throw new ClientException("Invalid content length specified");
}
}
else
ContentLength = null;
if (useRealIP)
{
if (!Headers.TryGetValue("X-Real-IP", out ClientAddress))
ClientAddress = clientAddress;
}
else
ClientAddress = clientAddress;
Content = new Dictionary<string, string>();
//Arguments are null until set by a non-default Handler
Arguments = null;
RequestHandler = null;
}