Skip to content

Commit

Permalink
less exceptions catching on runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorium committed Nov 6, 2023
1 parent ef4ed85 commit d5ccb61
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 1.0.38 - November 1 2023
* Less exception catching on runtime

### 1.0.37 - November 1 2023
* Minor performance improvements
* FSharp.Core update
Expand Down
8 changes: 4 additions & 4 deletions src/Owin.Compression.Standard/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("Owin.Compression.Standard")>]
[<assembly: AssemblyProductAttribute("Owin.Compression")>]
[<assembly: AssemblyDescriptionAttribute("Compression (Deflate / GZip) module for Microsoft OWIN Selfhost filesystem pipeline.")>]
[<assembly: AssemblyVersionAttribute("1.0.37")>]
[<assembly: AssemblyFileVersionAttribute("1.0.37")>]
[<assembly: AssemblyVersionAttribute("1.0.38")>]
[<assembly: AssemblyFileVersionAttribute("1.0.38")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "Owin.Compression.Standard"
let [<Literal>] AssemblyProduct = "Owin.Compression"
let [<Literal>] AssemblyDescription = "Compression (Deflate / GZip) module for Microsoft OWIN Selfhost filesystem pipeline."
let [<Literal>] AssemblyVersion = "1.0.37"
let [<Literal>] AssemblyFileVersion = "1.0.37"
let [<Literal>] AssemblyVersion = "1.0.38"
let [<Literal>] AssemblyFileVersion = "1.0.38"
12 changes: 8 additions & 4 deletions src/Owin.Compression.Standard/CompressionModule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ module OwinCompression =

let create304Response (contextResponse:HttpResponse) =
if not contextResponse.HasStarted then
contextResponse.StatusCode <- 304
if contextResponse.StatusCode <> 304 then
contextResponse.StatusCode <- 304
contextResponse.Body.Close()
contextResponse.Body <- Stream.Null
contextResponse.ContentLength <- Nullable()
if contextResponse.ContentLength.HasValue then
contextResponse.ContentLength <- Nullable()
false

let checkNoValidETag (contextRequest:HttpRequest) (contextResponse:HttpResponse) (cancellationSrc:Threading.CancellationTokenSource) (itemToCheck:Stream) =
Expand Down Expand Up @@ -243,7 +245,8 @@ module OwinCompression =
contextResponse.Headers.["Transfer-Encoding"] <- "chunked"
true
else
contextResponse.ContentLength <- Nullable op.LongLength
if (not contextResponse.ContentLength.HasValue) || (contextResponse.ContentLength.Value <> -1 && contextResponse.ContentLength.Value <> op.LongLength) then
contextResponse.ContentLength <- Nullable op.LongLength
false

with | _ ->
Expand Down Expand Up @@ -348,7 +351,8 @@ module OwinCompression =
|| contextResponse.Headers.["Transfer-Encoding"] <> StringValues("chunked") then
contextResponse.Headers.["Transfer-Encoding"] <- StringValues("chunked")
else
contextResponse.ContentLength <- Nullable(op.LongLength)
if (not contextResponse.ContentLength.HasValue) || (contextResponse.ContentLength.Value <> -1 && contextResponse.ContentLength.Value <> op.LongLength) then
contextResponse.ContentLength <- Nullable(op.LongLength)
with | _ -> () // Content length info is not so important...

use tmpOutput = new MemoryStream(op)
Expand Down
8 changes: 4 additions & 4 deletions src/Owin.Compression/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("Owin.Compression")>]
[<assembly: AssemblyProductAttribute("Owin.Compression")>]
[<assembly: AssemblyDescriptionAttribute("Compression (Deflate / GZip) module for Microsoft OWIN Selfhost filesystem pipeline.")>]
[<assembly: AssemblyVersionAttribute("1.0.37")>]
[<assembly: AssemblyFileVersionAttribute("1.0.37")>]
[<assembly: AssemblyVersionAttribute("1.0.38")>]
[<assembly: AssemblyFileVersionAttribute("1.0.38")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "Owin.Compression"
let [<Literal>] AssemblyProduct = "Owin.Compression"
let [<Literal>] AssemblyDescription = "Compression (Deflate / GZip) module for Microsoft OWIN Selfhost filesystem pipeline."
let [<Literal>] AssemblyVersion = "1.0.37"
let [<Literal>] AssemblyFileVersion = "1.0.37"
let [<Literal>] AssemblyVersion = "1.0.38"
let [<Literal>] AssemblyFileVersion = "1.0.38"
12 changes: 8 additions & 4 deletions src/Owin.Compression/CompressionModule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ module OwinCompression =
else ValueNone

let create304Response (contextResponse:IOwinResponse) =
contextResponse.StatusCode <- 304
if contextResponse.StatusCode <> 304 then
contextResponse.StatusCode <- 304
contextResponse.Body.Close()
contextResponse.Body <- Stream.Null
contextResponse.ContentLength <- Nullable()
if contextResponse.ContentLength.HasValue then
contextResponse.ContentLength <- Nullable()
false

let checkNoValidETag (contextRequest:IOwinRequest) (contextResponse:IOwinResponse) (cancellationSrc:Threading.CancellationTokenSource) (itemToCheck:Stream) =
Expand Down Expand Up @@ -218,7 +220,8 @@ module OwinCompression =
contextResponse.Headers.["Transfer-Encoding"] <- "chunked"
true
else
contextResponse.ContentLength <- Nullable op.LongLength
if (not contextResponse.ContentLength.HasValue) || (contextResponse.ContentLength.Value <> -1 && contextResponse.ContentLength.Value <> op.LongLength) then
contextResponse.ContentLength <- Nullable op.LongLength
false

with | _ ->
Expand Down Expand Up @@ -323,7 +326,8 @@ module OwinCompression =
|| contextResponse.Headers.["Transfer-Encoding"] <> "chunked" then
contextResponse.Headers.["Transfer-Encoding"] <- "chunked"
else
contextResponse.ContentLength <- Nullable(op.LongLength)
if (not contextResponse.ContentLength.HasValue) || (contextResponse.ContentLength.Value <> -1 && contextResponse.ContentLength.Value <> op.LongLength) then
contextResponse.ContentLength <- Nullable(op.LongLength)
with | _ -> () // Content length info is not so important...

use tmpOutput = new MemoryStream(op)
Expand Down

0 comments on commit d5ccb61

Please sign in to comment.