mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-03-25 15:00:02 +00:00
fixed issue of download log option giving truncated file with fixed 2mb limit by making the limit option configurable.
This commit is contained in:
@@ -405,7 +405,12 @@ namespace DnsServerCore
|
||||
string logFileName = pathParts[2];
|
||||
string logFile = Path.Combine(_log.LogFolder, logFileName + ".log");
|
||||
|
||||
LogManager.DownloadLog(response, logFile, 2 * 1024 * 1024);
|
||||
int limit = 0;
|
||||
string strLimit = request.QueryString["limit"];
|
||||
if (!string.IsNullOrEmpty(strLimit))
|
||||
limit = int.Parse(strLimit);
|
||||
|
||||
LogManager.DownloadLog(response, logFile, limit * 1024 * 1024);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace DnsServerCore
|
||||
string _logFile;
|
||||
StreamWriter _logOut;
|
||||
DateTime _logDate;
|
||||
|
||||
|
||||
readonly object _logFileLock = new object();
|
||||
|
||||
#endregion
|
||||
@@ -117,7 +117,7 @@ namespace DnsServerCore
|
||||
response.ContentType = "text/plain";
|
||||
response.AddHeader("Content-Disposition", "attachment;filename=" + Path.GetFileName(logFile));
|
||||
|
||||
if (limit > fS.Length)
|
||||
if ((limit > fS.Length) || (limit < 1))
|
||||
limit = fS.Length;
|
||||
|
||||
OffsetStream oFS = new OffsetStream(fS, 0, limit);
|
||||
|
||||
@@ -2651,7 +2651,7 @@ function viewLog(logFile) {
|
||||
divLogViewer.show();
|
||||
|
||||
HTTPGetFileRequest({
|
||||
url: "/log/" + logFile + "?token=" + token,
|
||||
url: "/log/" + logFile + "?limit=2&token=" + token,
|
||||
success: function (response) {
|
||||
|
||||
divLogViewerLoader.hide();
|
||||
|
||||
Reference in New Issue
Block a user