コード例 #1
0
ファイル: WebService.cs プロジェクト: XWolfOverride/Sunfish
 private void ProcessGET(string path, HttpCall call)
 {
     if (path.EndsWith("/"))
     {
         VFSItem idx = vfs.GetItem(path + index);
         //Directory entry, go for index file or navigation
         if (index != null)
         {
             if (idx != null && !idx.Directory)
             {
                 DownloadAt(idx, call);
                 return;
             }
         }
         if (allowNavigation)
         {
             //TODO: Block subfolder navigation if not allowed checking path
             idx = vfs.GetItem(path);
             if (idx != null && idx.Directory)
             {
                 WriteIndex(path, idx, call);
             }
             else
             {
                 call.HTTPNotFound();
             }
         }
         else
         {
             call.HTTPForbidden();
         }
     }
     else
     {
         VFSItem idx = vfs.GetItem(path);
         if (idx != null)
         {
             if (idx.Directory)
             {
                 call.Redirect(call.Request.Url.LocalPath + "/");
             }
             else
             {
                 DownloadAt(idx, call);
             }
         }
         else
         {
             call.HTTPNotFound();
         }
     }
 }