-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Don't Flush read-only streams from CryptoStream - #27326 #27327
Conversation
cc: @bartonjs |
@@ -128,7 +128,7 @@ public void FlushFinalBlock() | |||
innerCryptoStream.FlushFinalBlock(); | |||
} | |||
} | |||
else | |||
else if (_canWrite) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A FileStream opened in read mode still has semantic behaviors on Flush, and not calling it could have observable consequences to caller code (and that was simply the first kind of stream I looked at). I don't know that there's a safe way to make this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, basically, you are telling that my issue (CryptoStream
throwing exceptions in Dispose
) is a bug in Kestrel server that doesn't allow to call Flush
on read-only stream, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, sorry. If they can't/won't fix it you could add yet another Stream as a wrapper over it, which just intercepts the call to Flush and doesn't pass it on.
I checked the .NET Framework 2.0 source base, and CryptoStream definitely had this behavior back that far.
Because read-only streams apparently can have Flush semantics and this behavior is expected by some of built-in stream wrappers (e. g. CryptoStream) dotnet/corefx#27327 (review) aspnet#2341
Yeah, it's a breaking change; so it would require exposing options... or just fixing the stream type which is throwing on Flush (which is the path being pursued). |
Because read-only streams apparently can have Flush semantics and this behavior is expected by some of built-in stream wrappers (e. g. CryptoStream) dotnet/corefx#27327 (review) aspnet#2341
Because read-only streams apparently can have Flush semantics and this behavior is expected by some of built-in stream wrappers (e. g. CryptoStream) dotnet/corefx#27327 (review) aspnet#2341
Because read-only streams apparently can have Flush semantics and this behavior is expected by some of built-in stream wrappers (e. g. CryptoStream) dotnet/corefx#27327 (review) aspnet#2341
Because read-only streams apparently can have Flush semantics and this behavior is expected by some of built-in stream wrappers (e. g. CryptoStream) dotnet/corefx#27327 (review) #2341
https://github.com/dotnet/corefx/issues/27326