private static void PrepareRackRequest(HttpListenerRequest source,RackRequest target)
{
target.RequestMethod = source.HttpMethod;
target.ApplicationPath = String.Empty;
//Currently not supporting virtual directories / applications
target.ResourcePath = source.Url.LocalPath;
target.QueryString = source.Url.Query;
target.ServerName = source.Url.Host;
target.ServerPort = source.Url.Port;
target.UrlScheme = source.Url.Scheme.ToLower();
target.Body = new StreamReader(source.InputStream).ReadToEnd();
target.RemoteAddress = source.Url.Host;
target.ServerProtocol = source.Headers["SERVER_PROTOCOL"];
target.RequestPath = source.Url.AbsolutePath;
target.RemoteAddress = source.RemoteEndPoint.Address.ToString();
target.HttpVersion = source.ProtocolVersion.ToString();
target.RequestUri = source.Url.ToString();
target.GatewayInterface = source.Headers["GATEWAY_INTERFACE"];
target.ContentType = source.Headers["CONTENT_TYPE"];
target.ContentLength = Convert.ToInt32(source.ContentLength64);
target.AddHeaders(source.Headers);
}
}