Permalink
Browse files

fix IE over SSL bug

  • Loading branch information...
1 parent 9425cc0 commit faf8a4204ec3f2ead94f4b3d1e1535b340c7a2bc Andrew N committed Dec 16, 2008
Showing with 15 additions and 3 deletions.
  1. +15 −3 lib/prawnto/template_handler/base.rb
@@ -9,14 +9,26 @@ def ie_request?
@view.request.env['HTTP_USER_AGENT'] =~ /msie/i
end
+ def ssl_request?
+ @view.request.env['SERVER_PROTOCOL'].downcase == "https"
+ end
+
# TODO: kept around from railspdf-- maybe not needed anymore? should check.
- def set_pragma
- @view.headers['Pragma'] ||= ie_request? ? 'no-cache' : ''
+ def set_pragma
+ if ssl_request? && ie_request?
+ @view.headers['Pragma'] = 'public'
+ else
+ @view.headers['Pragma'] ||= ie_request? ? 'no-cache' : ''
+ end
end
# TODO: kept around from railspdf-- maybe not needed anymore? should check.
def set_cache_control
- @view.headers['Cache-Control'] ||= ie_request? ? 'no-cache, must-revalidate' : ''
+ if ssl_request? && ie_request?
+ @view.headers['Cache-Control'] = 'maxage=1'
+ else
+ @view.headers['Cache-Control'] ||= ie_request? ? 'no-cache, must-revalidate' : ''
+ end
end
def set_content_type

0 comments on commit faf8a42

Please sign in to comment.