1. 14 6月, 2018 1 次提交
    • D
      Add support for more HTTP cache controls · c94a0075
      Daniel Schierbeck 提交于
      From <https://tools.ietf.org/html/rfc5861>:
      
      > The stale-if-error HTTP Cache-Control extension allows a cache to
      > return a stale response when an error -- e.g., a 500 Internal Server
      > Error, a network segment, or DNS failure -- is encountered, rather
      > than returning a "hard" error.  This improves availability.
      >
      > The stale-while-revalidate HTTP Cache-Control extension allows a
      > cache to immediately return a stale response while it revalidates it
      > in the background, thereby hiding latency (both in the network and on
      > the server) from clients.
      
      These are useful, fully standardized parts of the HTTP protocol with
      widespread support among CDN vendors. Supporting them will make it
      easier to utilize reverse proxies and CDNs from Rails.
      c94a0075
  2. 22 8月, 2017 1 次提交
  3. 29 7月, 2017 1 次提交
  4. 02 7月, 2017 1 次提交
  5. 01 7月, 2017 1 次提交
  6. 30 5月, 2017 1 次提交
  7. 29 10月, 2016 1 次提交
  8. 07 9月, 2016 1 次提交
  9. 16 8月, 2016 1 次提交
  10. 07 8月, 2016 2 次提交
  11. 30 5月, 2016 1 次提交
    • R
      Tiny document fixes [ci skip] · 1afdbbeb
      Robin Dupret 提交于
      Add a missing capital letter and avoid using absolute links to the
      API because they may refer to out-dated documentation on the Edge
      site.
      1afdbbeb
  12. 03 4月, 2016 1 次提交
  13. 02 4月, 2016 1 次提交
  14. 01 4月, 2016 1 次提交
    • J
      Strong ETag validators · c1c9c690
      Jeremy Daer 提交于
      * Introduce `Response#strong_etag=` and `#weak_etag=` and analogous options
        for `fresh_when` and `stale?`. `Response#etag=` sets a weak ETag.
      
        Strong ETags are desirable when you're serving byte-for-byte identical
        responses that support Range requests, like PDFs or videos (typically
        done by reproxying the response from a backend storage service).
        Also desirable when fronted by some CDNs that support strong ETags
        only, like Akamai.
      
      * No longer strips quotes (`"`) from ETag values before comparing them.
        Quotes are significant, part of the ETag. A quoted ETag and an unquoted
        one are not the same entity.
      
      * Support `If-None-Match: *`. Rarely useful for GET requests; meant
        to provide some optimistic concurrency control for PUT requests.
      c1c9c690
  15. 05 3月, 2016 1 次提交
  16. 03 3月, 2016 1 次提交
  17. 31 12月, 2015 1 次提交
    • R
      Avoid `Time.parse` for static date · 040ed266
      Rafaël Blais Masson 提交于
        Benchmark.ips do |x|
          x.report('Time.parse') { Time.parse('2011-01-01') }
          x.report('Time.new')   { Time.new(2011, 1, 1) }
        end
      
        Calculating -------------------------------------
                  Time.parse     6.640k i/100ms
                    Time.new    15.082k i/100ms
        -------------------------------------------------
                  Time.parse     71.915k (± 3.1%) i/s -    365.200k
                    Time.new    167.645k (± 3.3%) i/s -    844.592k
      040ed266
  18. 15 11月, 2015 1 次提交
  19. 27 8月, 2015 1 次提交
    • A
      remove RackDelegation module · d4743874
      Aaron Patterson 提交于
      Since all controller instances are required to have a request and
      response object, RackDelegation is no longer needed (we always have to
      delegate to the response)
      d4743874
  20. 23 5月, 2015 1 次提交
  21. 05 3月, 2015 1 次提交
  22. 16 2月, 2015 2 次提交
  23. 11 2月, 2015 3 次提交
    • C
      Accept a collection in fresh_when and stale? · 050fda02
      claudiob 提交于
      The methods `fresh_when` and `stale?` from ActionController::ConditionalGet
      accept a single record as a short form for a hash. For instance
      
      ```ruby
        def show
          @article = Article.find(params[:id])
          fresh_when(@article)
        end
      ```
      
      is just a short form for:
      
      ```ruby
        def show
          @article = Article.find(params[:id])
          fresh_when(etag: @article, last_modified: @article.created_at)
        end
      ```
      
      This commit extends `fresh_when` and `stale?` to also accept a collection
      of records, so that a short form similar to the one above can be used in
      an `index` action. After this commit, the following code:
      
      ```ruby
      def index
        @article = Article.all
        fresh_when(etag: @articles, last_modified: @articles.maximum(:created_at))
      end
      ```
      
      can be simply written as:
      
      ```ruby
      def index
        @article = Article.all
        fresh_when(@articles)
      end
      ```
      050fda02
    • C
      Fix wrong kwarg "record" from #18872 · c7331e05
      claudiob 提交于
      PR #18772 changed the parameters of `stale?` to use `kwargs`.
      [As for this comment](https://github.com/rails/rails/pull/18872/files#r24456288)
      the default value for the `etag` parameter should be `record`, not `nil`.
      
      This commit fixes the code and introduces a test that:
      
      - passed before #18872
      - fails on the current master (after #18772)
      - passes again after setting the default value of `etag` to `record`.
      c7331e05
    • K
      7a78c251
  24. 07 1月, 2015 1 次提交
    • C
      Better examples for fresh_when and stale? · 283326cc
      claudiob 提交于
      It is clearer and closer to reality to use `@article.updated_at` as
      the `:last_modified` parameter of `fresh_when` and `stale?`.
      
      Using `@article.created_at` would result in the cache never expiring,
      since the creation timestamp never changes.
      
      [ci skip]
      283326cc
  25. 17 9月, 2014 2 次提交
  26. 17 8月, 2014 1 次提交
    • J
      When your templates change, browser caches bust automatically. · 6c96602b
      Jeremy Kemper 提交于
      New default: the template digest is automatically included in your ETags.
      When you call `fresh_when @post`, the digest for `posts/show.html.erb`
      is mixed in so future changes to the HTML will blow HTTP caches for you.
      This makes it easy to HTTP-cache many more of your actions.
      
      If you render a different template, you can now pass the `:template`
      option to include its digest instead:
      
        fresh_when @post, template: 'widgets/show'
      
      Pass `template: false` to skip the lookup. To turn this off entirely, set:
      
        config.action_controller.etag_with_template_digest = false
      6c96602b
  27. 01 2月, 2013 1 次提交
  28. 06 1月, 2013 1 次提交
  29. 05 12月, 2012 1 次提交
    • C
      Replace comments' non-breaking spaces with spaces · 019df988
      claudiob 提交于
      Sometimes, on Mac OS X, programmers accidentally press Option+Space
      rather than just Space and don’t see the difference. The problem is
      that Option+Space writes a non-breaking space (0XA0) rather than a
      normal space (0x20).
      
      This commit removes all the non-breaking spaces inadvertently
      introduced in the comments of the code.
      019df988
  30. 28 10月, 2012 1 次提交
  31. 23 9月, 2012 1 次提交
  32. 07 9月, 2012 1 次提交
  33. 30 8月, 2012 3 次提交