Skip to content

Commit

Permalink
Merge pull request #247 from janjonas/DNN-5206
Browse files Browse the repository at this point in the history
DNN-5206: DotNetNuke.Services.FileSystemFileManager.WriteFileToHttpContext(): Do not send negative "Content-Length" header
  • Loading branch information
cnurse committed Mar 13, 2015
2 parents 6c198bb + 128cb07 commit 55d5765
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DNN Platform/Library/Services/FileSystem/FileManager.cs
Expand Up @@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
Expand Down Expand Up @@ -1777,7 +1778,8 @@ internal virtual void WriteFileToHttpContext(IFileInfo file, ContentDisposition
throw new ArgumentOutOfRangeException("contentDisposition");
}

objResponse.AppendHeader("Content-Length", file.Size.ToString());
// Do not send negative Content-Length (file.Size could be negative due to integer overflow for files > 2GB)
if (file.Size >= 0) objResponse.AppendHeader("Content-Length", file.Size.ToString(CultureInfo.InvariantCulture));
objResponse.ContentType = GetContentType(file.Extension.Replace(".", ""));

try
Expand Down

0 comments on commit 55d5765

Please sign in to comment.