Skip to content

Commit 45c876b

Browse files
Reset InputStream position. Bump revision number. (#12)
1 parent f59705b commit 45c876b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/OutputCacheModuleAsync/OutputCacheHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,10 @@ private string CreateOutputCachedItemKey(string path, string verb, CachedVary ca
943943
}
944944
if (contentLength > 0) {
945945
using (var ms = new MemoryStream()) {
946+
// request.InputStream always returns CanSeek == true, so we can restore position like this
947+
var pos = request.InputStream.Position;
946948
request.InputStream.CopyTo(ms);
949+
request.InputStream.Position = pos;
947950
byte[] buf = ms.ToArray();
948951
// Use SHA256 to generate a collision-free hash of the input data
949952
value = Convert.ToBase64String((CryptoUtil.ComputeHash(buf)));

tools/OutputCacheModuleAsync.settings.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<BuildQuality Condition="'$(BuildQuality)' == ''">rtm</BuildQuality>
55
<VersionMajor>1</VersionMajor>
66
<VersionMinor>0</VersionMinor>
7-
<VersionRelease>2</VersionRelease>
7+
<VersionRelease>3</VersionRelease>
88
</PropertyGroup>
99
<Target Name="SetNuSpecProperties">
1010
<PropertyGroup>

0 commit comments

Comments
 (0)