/// <summary> /// Lists directory, or writes file contents in the HTTP response as per the /// the response received from the DEA. If the "tail" parameter is part of /// the HTTP request, then the file contents are streamed through chunked /// HTTP transfer encoding. Otherwise, the entire file is dumped in the HTTP /// response. /// Writes appropriate errors and status codes in the HTTP response if there is /// a problem in reading the file or directory. /// </summary> /// <param name="path">The path.</param> /// <param name="tail">if set to <c>true</c> it means we tail the file live.</param> /// <param name="context">Http context to respond to.</param> private void ListPath(string path, bool tail, HttpListenerContext context) { if (File.Exists(path)) { this.WriteFile(path, tail, context); } else if (Directory.Exists(path)) { DirectoryServer.ListDir(path, context); } else { Logger.Warning(Strings.PathNotFound, path); DirectoryServer.WriteEntityNotFound(context); } }