I've been using Griffin Webserver successfully on Win32 and have now started testing out on Mono/Linux. I had a couple of problems with files in subdirectories which I think were down to path separator differences between the platforms.
To get this going I changed,
DiskFileService.cs
string GetFullPath(Uri uri)
{
if (!uri.AbsolutePath.StartsWith(_rootUri))
return null;
var relativeUri = Uri.UnescapeDataString(uri.AbsolutePath.Remove(0, _rootUri.Length));
return Path.Combine(_basePath, relativeUri.TrimStart('/').Replace('/', '\\'));
}
to
private string GetFullPath(Uri uri)
{
if (!uri.AbsolutePath.StartsWith(_rootUri))
return null;
var relativeUri = Uri.UnescapeDataString(uri.AbsolutePath.Remove(0, _rootUri.Length));
return Path.Combine(_basePath, relativeUri.TrimStart('/').Replace('/', Path.DirectorySeparatorChar));
}
I also found I had a problem with a missing / in indexes so changed,
bool TryGenerateDirectoryPage(IHttpContext context)
{
..
foreach (var file in _fileService.GetFiles(context.Request.Uri))
{
var fileUri = context.Request.Uri.AbsolutePath + file.Name;
..
to
bool TryGenerateDirectoryPage(IHttpContext context)
{
..
foreach (var file in _fileService.GetFiles(context.Request.Uri))
{
var fileUri = context.Request.Uri.AbsolutePath + file.Name;
if (!fileUri.EndsWith("/"))
fileUri += "/";
fileUri += file.Name;
..
Hi,
I've been using Griffin Webserver successfully on Win32 and have now started testing out on Mono/Linux. I had a couple of problems with files in subdirectories which I think were down to path separator differences between the platforms.
To get this going I changed,
DiskFileService.cs
to
I also found I had a problem with a missing / in indexes so changed,
to
Hope this helps.
Cheers,
Alex Lennon