Skip to content

Commit

Permalink
close upstream body on successful validation responses
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Apr 13, 2011
1 parent 653ca39 commit baeca6b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/rack/cache/context.rb
Expand Up @@ -215,6 +215,11 @@ def validate(entry)
next unless value = response.headers[name]
entry.headers[name] = value
end

# even though it's empty, be sure to close the response body from upstream
# because middleware use close to signal end of response
response.body.close if response.body.respond_to?(:close)

response = entry
else
record :invalid
Expand Down

0 comments on commit baeca6b

Please sign in to comment.