public override void handleGETRequest(HttpProcessor p) { if (p.http_url == "/") { p.http_url = "/index.html"; } Console.WriteLine("request: {0}", p.http_url); Console.WriteLine(Directory.GetCurrentDirectory()); int nBytes = 2048; FileStream fs; try { if (p.http_url.Split('/')[1] == "Files") { fs = new FileStream(Directory.GetCurrentDirectory() + p.http_url, FileMode.Open, FileAccess.Read); p.writeSuccessRar("", fs.Length, @"application/x-rar-compressed, application/octet-stream"); while (true) { byte[] ByteArray = new byte[nBytes]; int nBytesRead = fs.Read(ByteArray, 0, nBytes); if (nBytesRead == 0) { break; } p.outputStream.BaseStream.Write(ByteArray, 0, ByteArray.Length); } fs.Close(); } else { p.writeSuccess(); p.outputStream.Write(@"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'> <html><meta charset='utf-8'><head><title></title></head> "); if (!p.isAuth()) { p.printAuth(); return; } p.outputStream.Write(@"<body>"); PrintTable(p); } } catch (Exception ex) { p.outputStream.WriteLine("404 - файл " + p.http_url + " не найден.<br>" + ex.Message); Console.WriteLine("404 - файл " + p.http_url + " не найден.<br>" + ex.Message); } }