aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/conditional_get.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use native `Array#append`, `Array#prepend`, `Hash#transform_keys`, and ↵Ryuta Kamizono2018-12-201-2/+0
| | | | | | | | | | `Hash#transform_keys!` Since Rails 6 requires Ruby 2.5. https://github.com/ruby/ruby/blob/ruby_2_5/NEWS Follow up #34754.
* Update documentation to ActionController::ConditionalGetAnatoly Mikhaylov2018-09-031-0/+6
| | | | Two implemented but undocumented features are to help indicate that cache is fresh for 3 hours, and it may continue to be served stale for up to an additional 60 seconds to parallel requests for the same resource or up to 5 minutes while errors are being returned back while the initial synchronous revalidation is attempted.
* Add support for more HTTP cache controlsDaniel Schierbeck2018-06-131-1/+3
| | | | | | | | | | | | | | | | | | 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.
* Update links to use https link instead of http [ci skip]Yoshiyuki Hirano2017-08-221-1/+1
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-291-2/+1
| | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Merge pull request #26016 from nateberkopec/patch-1Vipul A M2016-09-071-2/+3
|\ | | | | Clarify expires_now documentation
| * Clarify expires_now documentationNate Berkopec2016-09-061-2/+3
| | | | | | | | [ci skip]
* | Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | modernizes hash syntax in actionpackXavier Noria2016-08-061-4/+4
| |
* | applies new string literal convention in actionpack/libXavier Noria2016-08-061-1/+1
|/ | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Tiny document fixes [ci skip]Robin Dupret2016-05-301-1/+1
| | | | | | 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.
* Grammar fixes based on pass over ETag doc changesVipul A M2016-04-031-2/+2
| | | | [ci skip]
* Grammer fix in comment: capitalize first word in sentence [ci skip].utilum2016-04-021-1/+1
|
* Strong ETag validatorsJeremy Daer2016-03-311-13/+46
| | | | | | | | | | | | | | | | | | * 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.
* Remove http_cache_forever's version parameterJean Boussier2016-03-051-4/+2
|
* Change 'a HTTP' to 'an HTTP' [ci skip]Santosh Wadghule2016-03-031-4/+4
|
* Avoid `Time.parse` for static dateRafaël Blais Masson2015-12-301-1/+1
| | | | | | | | | | | | | | 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
* [ci skip] Fix <tt> in docclaudiob2015-11-151-1/+1
|
* remove RackDelegation moduleAaron Patterson2015-08-261-1/+0
| | | | | | 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)
* Spelling/typo/grammatical fixes [ci skip]karanarora2015-05-231-2/+2
| | | | | | | | | | spelling fix [ci skip] example to be consistent [ci skip] grammatical fix typo fixes [ci skip]
* Doc fix [ci skip]Sushruth Sivaramakrishnan2015-03-051-1/+1
|
* Tiny documentation edits [ci skip]Robin Dupret2015-02-151-3/+3
|
* Implement http_cache_forever to ActionControllerArthur Neves2015-02-151-0/+18
| | | | | | | | | Add http_cache_forever to ActionController, so we can cache results forever. Things like static pages are a good candidate for this type of caching. This cache only controls caching headers, so it is up to the browser to cache those requests.
* Accept a collection in fresh_when and stale?claudiob2015-02-101-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Fix wrong kwarg "record" from #18872claudiob2015-02-101-1/+1
| | | | | | | | | | | | 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`.
* Convert stale? and fresh_when to use keyword arguments.Kasper Timm Hansen2015-02-101-12/+10
|
* Better examples for fresh_when and stale?claudiob2015-01-061-2/+2
| | | | | | | | | | 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]
* Consistently markup etag options.Steven Harman2014-09-161-3/+3
|
* Consistently capitalize ETag.Steven Harman2014-09-161-3/+3
|
* When your templates change, browser caches bust automatically.Jeremy Kemper2014-08-171-6/+31
| | | | | | | | | | | | | | | | 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
* Missing require hash/keysAkira Matsuda2013-02-011-0/+2
|
* These are already required through AS/railsAkira Matsuda2013-01-061-2/+0
| | | | | | | * core_ext/object/blank * concern * core_ext/class/attribute * deprecation
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-1/+1
| | | | | | | | | | 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.
* Multiple changes to 1,9 hash syntaxAvnerCohen2012-10-271-1/+1
|
* update AC::ConditionalGet documentation [ci skip]Francesco Rodriguez2012-09-221-27/+31
|
* Use merge! to merge additional options onto default optionsCarlos Antonio da Silva2012-09-071-4/+3
|
* Fixes warning: & interpreted as argument prefixkennyj2012-08-301-1/+1
|
* Use class_attribute so we dont bleedDavid Heinemeier Hansson2012-08-291-1/+6
|
* Added controller-level etag additions that will be part of the action etag ↵David Heinemeier Hansson2012-08-291-4/+34
| | | | computation *Jeremy Kemper/DHH*
* Removing ==Examples and last blank lines of docs from actionpackFrancesco Rodriguez2012-05-151-1/+0
|
* Removed max-stale from the setting the cache-headers in the response as ↵Anuj Dutta2012-03-021-1/+1
| | | | max-stale is a cache request header.
* Merge pull request #3479 from arvida/ensure-date-header-on-expires-inJosé Valim2012-02-181-0/+3
|\ | | | | Ensure Date header on expires_in
| * Ensuring a HTTP Date header when setting Cache-Control's max-age with ↵arvida2011-10-311-0/+3
| | | | | | | | #expires_in
* | let expires_in accept a must_revalidate flagXavier Noria2012-02-171-2/+6
| |
* | Revert "Added ActiveRecord::Base#last_modified to work with the new ↵David Heinemeier Hansson2011-12-011-2/+2
| | | | | | | | | | | | | | | | fresh_when/stale? conditional get methods from Action Pack" Needless indirection with no added value. This reverts commit 535853e83b9092078035a5abb2aa242fba815c05.
* | Added ActiveRecord::Base#last_modified to work with the new ↵David Heinemeier Hansson2011-12-011-2/+2
| | | | | | | | fresh_when/stale? conditional get methods from Action Pack